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

Dariusz Bacinski commented on AMBER-71:
---------------------------------------

I am using only grant_type password and refresh_token. I didn't do anything, it 
just worked.

To fix random ClassNofFoundException I have added empty class 
javax.servlet.http.HttpServletReques to my project. Now it works without 
crashes, but it is quite dirty fix.


password:
        OAuthClientRequest request = OAuthClientRequest
                .tokenLocation(oAuthParams.getTokenEndpoint())
                .setClientId(oAuthParams.getClientId())
                
.setClientSecret(oAuthParams.getClientSecret()).setGrantType(GrantType.PASSWORD)
                .setUsername(uname).setPassword(pword).buildQueryMessage();

        OAuthClient client = new OAuthClient(getHttpClient());

        OAuthAccessTokenResponse oauthResponse = client.accessToken(request,
                OAuthJSONAccessTokenResponse.class);

refresh:

        OAuthClientRequest request = OAuthClientRequest
                .tokenLocation(oAuthParams.getTokenEndpoint())
                .setClientId(oAuthParams.getClientId())
                .setClientSecret(oAuthParams.getClientSecret())
                .setGrantType(GrantType.REFRESH_TOKEN)
                .setRefreshToken(oAuthParams.getRefreshToken())
                .buildQueryMessage();

        OAuthClient client = new OAuthClient(getHttpClient());

        OAuthAccessTokenResponse oauthResponse = client.accessToken(request,
                OAuthJSONAccessTokenResponse.class);
                
> ClassNofFoundException on Android
> ---------------------------------
>
>                 Key: AMBER-71
>                 URL: https://issues.apache.org/jira/browse/AMBER-71
>             Project: Amber
>          Issue Type: Bug
>            Reporter: Dariusz Bacinski
>            Priority: Critical
>
> We are successfully using Amber on Android platform.
> Unfortunately sometimes we are getting ClassNofFoundException when loading 
> OAuthUtils.format(...):
> https://svn.apache.org/repos/asf/incubator/amber/trunk/oauth-2.0/common/src/main/java/org/apache/amber/oauth2/common/utils/OAuthUtils.java
>  
> It is caused by import javax.servlet.http.HttpServletRequest;
> Can you remove this import? It is not necessary, it is only used in one 
> method.
> javax libs/imports are not available on Android.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to