Results 1 to 3 of 3

Thread: OAuth 2 POST with no request variables.

  1. #1
    Join Date
    Mar 2011
    Posts
    8

    Default 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.
    Attached Images Attached Images

  2. #2
    Join Date
    May 2008
    Location
    Salt Lake City
    Posts
    167

    Default

    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"/>

  3. #3
    Join Date
    Mar 2011
    Posts
    8

    Default

    That did the trick!!!

    Thank you so much.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •