[ 
https://issues.apache.org/jira/browse/OLTU-217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16253817#comment-16253817
 ] 

Rafael commented on OLTU-217:
-----------------------------

I'm creating a API Gateway and for my tests, I forked the oltu github 
repository, and included the body and the cause exception from authorization 
server. (https://github.com/rafaeluchoa/oltu/)

Test using this patched version from jitpack. Maybe it shows the real error 
from parametes.

Now, it returned error below:

OAuthProblemException{error='invalid_request', description='Missing parameters: 
access_token', uri='null', state='null', scope='null', redirectUri='null', 
responseStatus=0, parameters={}, 
body='*{"error":"invalid_grant","error_description":"User authentication 
failed: Invalid username/password."}*'}
        at 
org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:62)


<dependencies>
        <dependency>
                <groupId>com.github.rafaeluchoa.oltu</groupId>
                <artifactId>org.apache.oltu.oauth2.client</artifactId>
                <version>1.0.3-r1-SNAPSHOT</version>
        </dependency>
</dependencies>

<repositories>
        <repository>
                <id>jitpack.io</id>
                <url>https://jitpack.io</url>
        </repository>
</repositories>


> Missing parameters error while trying to get the access token.
> --------------------------------------------------------------
>
>                 Key: OLTU-217
>                 URL: https://issues.apache.org/jira/browse/OLTU-217
>             Project: Apache Oltu
>          Issue Type: Question
>          Components: oauth2-client
>    Affects Versions: oauth2-1.0.2
>            Reporter: sivan
>            Priority: Blocker
>
> Hi,
> I am using 1.0.2 version of OLTU oAuth client and now the implementation is 
> blocked due to the below issue.
> The grand type is password. I think for this grant type redirect URI is not 
> required.
> Below is the code for getting the access token in the first attempt.
> I have tried with both buildBodyMessage() and buildQueryMessage().
> But the error message shows the access token as missing parameter.
> Is anything else I need to set in the client request as parameter.
> Can you please help me in resolving this issue.
> *+{color:red}Error Message{color}+*
> invalid_request, Missing parameters: access_token
> Stack Trace:
> OAuthProblemException{error='invalid_request', description='Missing 
> parameters: access_token', uri='null', state='null', scope='null', 
> redirectUri='null', responseStatus=0, parameters={}}
> *+Java Code+*
> OAuthClientRequest request = 
> OAuthClientRequest.tokenLocation("https://qa.trustamerica.com/liberty/oauth/token";)
>                                                        
> .setGrantType(GrantType.PASSWORD)
>                                                        
> .setClientId("04B13831B0704781BB6FBE6CBD21B014")
>                                                        
> .setClientSecret("90CBA686949C4A7582948D0F852D08F2")
>                                                        
> .setUsername("apienvestnet")
>                                                        
> .setPassword("Integrate17$")
>                                                        .buildBodyMessage();
> OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
> GitHubTokenResponse oAuthResponse = oAuthClient.accessToken(request, 
> GitHubTokenResponse.class);
> Thanks
> Sivan



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to