Reputation: 137
I am trying to set up spring security with oauth2.0 in my application. and I am getting an exception:
UnsupportedGrantTypeException, Unsupported grant type: password
Is there anything that I am missing in configuration?
error logs:
org.springframework.security.oauth2.common.exceptions.UnsupportedGrantTypeException: Unsupported grant type: password
at org.springframework.security.oauth2.provider.endpoint.TokenEndpoint.postAccessToken(TokenEndpoint.java:134) ~[spring-security-oauth2-2.2.1.RELEASE.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201]
Upvotes: 0
Views: 2707
Reputation: 6479
In the configuration for your authorization server, when you extend AuthorizationServerConfigurerAdapter
, you can set up the authorized grant types for each of your clients.
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.inMemory()
.withClient("client1")
.authorizedGrantTypes("password")
.secret("{noop}secret")
.scopes("read")
.accessTokenValiditySeconds(600_000_000);
}
There is a full example in the spring-security authorization server sample.
Upvotes: 1
Reputation: 108
I think your Oauth server doesn't support password grant type. This one is used for getting "access tokens". I think that you should look for grant types handled by your OAuth server
Upvotes: 1