Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first improvements #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

first improvements #4

wants to merge 3 commits into from

Conversation

frankolschewski
Copy link

Do not Don't apply all my changes if you want to stay with MySQL and Maven (I haven't updated the pom.xml).

@yijiulove
Copy link

if you mean below error:

{
    "error": "invalid_client",
    "error_description": "Unauthorized grant type: password"
}

and please follow below way to fix authenticationManager null problem

  1. init bean on WebSecurityConfiguration
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
  1. inject into AuthorizationServerConfiguration
@Autowired
private AuthenticationManager authenticationManager;

@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    endpoints.approvalStore(approvalStore())
            .authorizationCodeServices(authorizationCodeServices())
            .tokenStore(tokenStore())
            .authenticationManager(authenticationManager);
}

and please do remember to add grant type password to client_id.
table oauth_client_details.authorized_grant_types value include client_credentials,password

and then

curl -X POST \
  http://localhost:8081/oauth/token \
  -H 'authorization: Basic Y3VybF9jbGllbnQ6cGFzc3dvcmQ=' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -H 'postman-token: 6815f1d7-995a-e894-fd48-50942b395c8b' \
  -F grant_type=password \
  -F username=resource_admin \
  -F password=password

response

{
    "access_token": "def5b27c-3684-454c-b70a-16c6fd6db9dc",
    "token_type": "bearer",
    "expires_in": 6199,
    "scope": "read write"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants