Announcement Announcement Module
Collapse
No announcement yet.
OAuth 2 POST with no request variables. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • OAuth 2 POST with no request variables.

    This took me a while to find out... I hope you guys will help me out.

    Just debugging with Eclipse inside the OAuth classes I found out that when is doing the POST request for the access_token no variables are passed on the body of the POST.

    I'm sure that I'm doing something wrong but I don't know why. The first part of the process requesting the code is working fine I can see the code being returned but as soon as is going against the server I get a 400.

    So finally I see that on the RestTemplate.class where:

    Code:
    URI expanded = uriTemplate.expand(urlVariables);
    		return doExecute(expanded, method, requestCallback, responseExtractor);
    Empty variables. Please see attached screenshot.

    And this is the answer I'm getting back from the provider:

    Code:
    {code=400, error_message=You must provide a client_secret, error_type=OAuthException}
    Also here is the config of my resource:

    Code:
    <oauth:resource id="instagram" 
        bearerTokenMethod="query"
        bearerTokenName="access_token"
        accessTokenUri="https://api.instagram.com/oauth/access_token"
        type="authorization_code" 
        clientId="XXX" 
        clientSecret="YYY"
        userAuthorizationUri="https://api.instagram.com/oauth/authorize"/>
    As you can see I'm trying to access the instagram api.

    Any help will be appreciated.

    Thx.

  • #2
    Try specifying a form-based client authentication scheme on the resource (default is HTTP Basic Auth):

    Code:
    <oauth:resource id="instagram" 
        bearerTokenMethod="query"
        bearerTokenName="access_token"
        accessTokenUri="https://api.instagram.com/oauth/access_token"
        type="authorization_code" 
        clientId="XXX" 
        clientSecret="YYY"
        userAuthorizationUri="https://api.instagram.com/oauth/authorize"
        clientAuthenticationScheme="form"/>

    Comment


    • #3
      That did the trick!!!

      Thank you so much.

      Comment

      Working...
      X