Results 1 to 5 of 5

Thread: 401 on receipt of token. What am I missing?

  1. #1
    Join Date
    Mar 2011
    Posts
    2

    Default 401 on receipt of token. What am I missing?

    I'm encountering a problem wherein I receive a 401 - Not authorized error when receiving a Gowalla oauth token using the ConnectController. I've verified that I am, in fact, receiving back a token by setting a breakpoint in the Oauth2Template where it executes the RestTemplate's postForObject method and visually inspecting the response.

    My two assumptions were that:

    1. The ConnectController would persist the connection in the connection table
    2. I would be redirected to the connect/gowallaConnected view (which I defined).

    What am I missing? What is the next step?

    Thanks in advance for your help!

  2. #2
    Join Date
    Aug 2004
    Posts
    1,099

    Default

    I can't say for sure what might be going wrong, but here are a few things to double-check:

    - Make sure you have configured a GowallaServiceProvider bean and are setting its API key and secret correctly in the 1st two constructor arguments.
    - Make sure that your application registration entry (on Gowalla.com) has an OAuth callback URL that matches your app configuration (http://localhost:8080/spring-social-...onnect/gowalla, for instance).

    What I'm unclear on is when you get the 401: Are you getting the 401 when you exchange the authorization code for an access token (sounds like not, since your debugging verifies that you receive an access token at that step)? Or are you getting a 401 when attempting to make calls against GowallaApi?
    Craig Walls
    Spring Social Project Lead

  3. #3
    Join Date
    Mar 2011
    Posts
    2

    Default My Token Spoiled

    I stepped more carefully through the code and noticed it bombing when it tried to get my Gowalla profile information (i.e. when I tried to interact with the API, as you suspected). Taking a closer look at the response, I notice that my access token has expired. I have to figure out how to refresh it, it seems. Is there a convenient way to do this in Spring Social? Either way, thanks for your help!

  4. #4
    Join Date
    Aug 2004
    Posts
    1,099

    Default

    Ah, an expired access token. Since this is Gowalla, that tells me that your token is about a week old. M2 doesn't have anything to enable token refreshes, but we're aiming to add in access token refreshes in M3.
    Craig Walls
    Spring Social Project Lead

  5. #5
    Join Date
    Apr 2011
    Posts
    1

    Default

    Thanks for sharing.

Posting Permissions

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