OAuthProblem, missing parameter access_token

后端 未结 2 1969
情书的邮戳
情书的邮戳 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 :)

提交回复
热议问题