在用戶身份驗證和批准後,當Oauth2客戶端應用程序從OAuth2 AuthServer的令牌端點請求令牌時,請求有關Spring引導OAuth2應用程序BadCredentialsException的幫助。Spring Boot Oauth2令牌請求 - 來自BasicAuthenticationFilter的錯誤客戶端憑證
春天啓動的OAuth2應用程序都基於現在著名的戴夫Syer春季啓動/ OAuth2用戶界面的客戶端/的oauth2 AuthServer/JWT例如https://github.com/spring-guides/tut-spring-security-and-angular-js/tree/master/oauth2
這是在客戶端應用程序調試:
DEBUG org.springframework.web.client.RestTemplate - Created POST request for "authserver/uaa/oauth/token"
DEBUG org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeAccessTokenProvider - Encoding and sending form: {grant_type=[authorization_code], code=[xxxxx], redirect_uri=[oauthclientapp/login]}
DEBUG org.springframework.web.client.RestTemplate - POST request for "authserver/uaa/oauth/token" resulted in 200 (null)
DEBUG org.springframework.security.oauth2.client.filter.OAuth2ClientAuthenticationProcessingFilter - Authentication request failed: org.springframework.security.authentication.BadCredentialsException: Could not obtain access token
這是AuthServer的調試:
DEBUG org.springframework.security.web.FilterChainProxy - /oauth/token at position 9 of 15 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
DEBUG org.springframework.security.web.authentication.www.BasicAuthenticationFilter - Basic Authentication Authorization header found for user 'clientID'
DEBUG org.springframework.security.authentication.ProviderManager - Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider
DEBUG org.springframework.security.authentication.dao.DaoAuthenticationProvider - User 'clientID' not found
DEBUG org.springframework.security.web.authentication.www.BasicAuthenticationFilter - Authentication request for failed: org.springframework.security.authentication.BadCredentialsException: Bad credentials
的OAuth2用戶端的應用程序就像一個在這個例子中,在令牌請求PR沒有定製只要無論@EnableOAuth2Sso給我們什麼。 AuthServer上的ClientDetails配置也如下例所示,所以沒什麼特別的。
任何建議,以更好地排除故障這是非常感謝。謝謝。
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("clientID")
.secret("acmesecret")
.authorizedGrantTypes("authorization_code", "refresh_token",
"password").scopes("openid");
}