You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@oltu.apache.org by "Allan Cheong Tyng Huei (JIRA)" <ji...@apache.org> on 2014/06/01 09:52:01 UTC

[jira] [Created] (OLTU-150) TokenValidator does not recognize access_token parameter

Allan Cheong Tyng Huei created OLTU-150:
-------------------------------------------

             Summary: TokenValidator does not recognize access_token parameter
                 Key: OLTU-150
                 URL: https://issues.apache.org/jira/browse/OLTU-150
             Project: Apache Oltu
          Issue Type: Bug
          Components: oauth2-client
    Affects Versions: oauth2-1.0.0
         Environment: WIndows 7 x64, JDK1.8
            Reporter: Allan Cheong Tyng Huei
            Priority: Critical


Code:
final String accessToken = "this-is-an-access-token";
OAuthClientRequest request = new OAuthBearerClientRequest("https://graph.facebook.com/me").setAccessToken(accessToken).buildQueryMessage();

System.out.println(request.getLocationUri());

final URLConnectionClient urlConnectionClient = new URLConnectionClient();
final OAuthJSONAccessTokenResponse jsonResponse = urlConnectionClient.execute(request, null, HttpMethod.GET, OAuthJSONAccessTokenResponse.class);

System.out.println(jsonResponse);

Exception:
https://graph.facebook.com/me?access_token=this-is-an-access-token
Exception in thread "main" OAuthProblemException{error='{"code":190,"message":"Invalid OAuth access token.","type":"OAuthException"}', description='null', uri='null', state='null', scope='null', redirectUri='null', responseStatus=0, parameters={}}
	at org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:59)
	at org.apache.oltu.oauth2.client.validator.OAuthClientValidator.validateErrorResponse(OAuthClientValidator.java:63)
	at org.apache.oltu.oauth2.client.validator.OAuthClientValidator.validate(OAuthClientValidator.java:48)
	at org.apache.oltu.oauth2.client.response.OAuthClientResponse.validate(OAuthClientResponse.java:64)
	at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:59)
	at org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:52)
	at org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory.createCustomResponse(OAuthClientResponseFactory.java:60)
	at org.apache.oltu.oauth2.client.URLConnectionClient.execute(URLConnectionClient.java:111)
	at my.package.Main.main(Main.java:208)



--
This message was sent by Atlassian JIRA
(v6.2#6252)