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

Getting "Unsupported grant type: password" when trying to get a token using grant_type=password #1213

Closed
fdimauro opened this issue Mar 22, 2017 · 4 comments

Comments

@fdimauro
Copy link

fdimauro commented Mar 22, 2017

Using Curl I am unable to get a token with grant_type =password.

Here is the curl statement I am using:

curl --user client -k -d "grant_type=password&username=pwmadmin&password=********&scope=openid" -H "Content-Type: application/x-www-form-urlencoded" http://localhost:9999/oic/token

and the response:

{"error":"unsupported_grant_type","error_description":"Unsupported grant type: password"}

I have enabled Grant Type "password" in the "Manage Clients" GUI but it has no effect.

@jricher
Copy link
Member

jricher commented Mar 22, 2017

Did you enable the password based token granter? Look in authz-config.xml for info. It's disabled by default because the password grant is horribly insecure.

@fdimauro
Copy link
Author

fdimauro commented Mar 23, 2017

Ok, Thanks I understand. I updated my authz-config.xml as follows:

       <oauth:authorization-server> 
		client-details-service-ref="defaultOAuth2ClientDetailsEntityService"
		authorization-request-manager-ref="connectOAuth2RequestFactory" 
		token-services-ref="defaultOAuth2ProviderTokenService" 
		user-approval-handler-ref="tofuUserApprovalHandler" 
		request-validator-ref="oauthRequestValidator"
		redirect-resolver-ref="blacklistAwareRedirectResolver"
		authorization-endpoint-url="/authorize" 
		token-endpoint-url="/token"
		error-page="/error">
		
		<oauth:authorization-code authorization-code-services-ref="defaultOAuth2AuthorizationCodeService"/>
		<oauth:implicit />
		<oauth:refresh-token/>
		<oauth:client-credentials/>
		<oauth:password/>
		<oauth:custom-grant token-granter-ref="chainedTokenGranter" />
		<oauth:custom-grant token-granter-ref="jwtAssertionTokenGranter" />

	</oauth:authorization-server>

I am getting a LDAP authorization error now but I believe it has to do with encrypting the password correctly when doing the curl command.

{"error":"unauthorized","error_description":"[LDAP: error code 50 - Insufficient Access Rights]; nested exception is javax.naming.NoPermissionException: [LDAP: error code 50 - Insufficient Access Rights]"}

@fdimauro
Copy link
Author

I was incorrect about the password encryption. I was using the wrong password.

I am using the password token in a Spring Boot Service to call in to a OAuth2 secured Spring Boot System. The calls into this service are authenticated using a different mechanism before a call into the OAuth2 secured system. We need to do this to support legacy access into our new secure system.

@fdimauro
Copy link
Author

Thanks for your assistance!

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

No branches or pull requests

2 participants