1

I am trying to obtain oauth token from WSO2 identity server:

curl -v  -X POST -u "GIHAZzRMGNnm3X8XGMwZVoCe2hUa:Uf4wAlQWufaTk320Se2emnJVgvca" -H  "Content-Type: application/x-www-form-urlencoded" -k -d "grant_type=password&[email protected]&password=mypwd" https://localhost:9449/oauth2/token

The response is {"error":"server_error","error_description":"Error when issuing the access token"}

The exception at the server

TID[-1234] [IS] [2015-08-08 11:53:15,692] ERROR {org.wso2.carbon.identity.oauth2.OAuth2Service} - Error when issuing the access token. org.wso2.carbon.identity.oauth2.token.handlers.grant.AbstractAuthorizationGrantHandler.issue(AbstractAuthorizationGrantHandler.java:207) org.wso2.carbon.identity.oauth2.token.AccessTokenIssuer.issue(AccessTokenIssuer.java:206) org.wso2.carbon.identity.oauth2.OAuth2Service.issueAccessToken(OAuth2Service.java:177) org.wso2.carbon.identity.oauth.endpoint.token.OAuth2TokenEndpoint.getAccessToken(OAuth2TokenEndpoint.java:230) org.wso2.carbon.identity.oauth.endpoint.token.OAuth2TokenEndpoint.issueAccessToken(OAuth2TokenEndpoint.java:108) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)

In the IS, I have enabled all grant types, Implicit and Client credentials were tested to work fine. This error occurs only from 'password' grant type. Could someone let me know what I am doing wrongly?

1 Answer 1

1

Please use this format to generate the token for password grant type.

curl -k -d "grant_type=password&username=<username>&password=<password>" -H "Authorization: Basic <Base64Encoded(Consumer key:consumer secret)>, Content-Type: application/x-www-form-urlencoded" https://<host>:8243/token
1
  • the problem seemed more due to using email as user name without the SP1 patch.
    – PaSh
    Sep 4, 2015 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.