OAuthProblem, missing parameter access_token

后端 未结 2 1939
情书的邮戳
情书的邮戳 2021-01-07 04:46

I\'m getting this error while trying to get an access token for a user. This has to do with the authorization process of a facebook application. The code that produces that

相关标签:
2条回答
  • 2021-01-07 05:32

    I had the same problem implementing the client and the server, the problem is about one mistake in the Client Example in the Apache Amber (Oltu) project:

    First you have the Auth code request (which work):

    OAuthClientRequest request = OAuthClientRequest
     .authorizationLocation(AUTHORIZE_URL)
     .setClientId(CLIENT_ID)
     .setRedirectURI(REDIR_URL)
     .setResponseType(CODE_RESPONSE)
     .**buildQueryMessage**();
    

    And second the request about the Access Token (which don't work):

    OAuthClientRequest request = OAuthClientRequest
      .tokenLocation(ACCESS_TOKEN_URL)
      .setGrantType(GrantType.AUTHORIZATION_CODE)
      .setClientId(CLIENT_ID)
      .setClientSecret(CLIENT_SECRET)
      .setRedirectURI(REDIR_URL)
      .setCode(code)
      .**buildBodyMessage**();
    

    The mistake is about the buildBodyMessage() in the second request. Change it by buildQueryMessage().

    Enjoy :)

    0 讨论(0)
  • 2021-01-07 05:44

    I think you can use the normal OAuthJSONAccessTokenResponse:

    OAuthAccessTokenResponse oAuthResponse = oAuthClient.accessToken(request);
    

    my problem is, Facebook responds with

    OAuthProblemException{description='null', error='{"message":"Error validating verification code.","type":"OAuthException","code":100}', uri='null', state='null', scope='null'}
    

    Any ideas?

    0 讨论(0)
提交回复
热议问题