Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Where is the Google refreshToken?

  1. #11
    Join Date
    Jan 2008
    Posts
    253

    Default

    Ok, resolved. You have to add the parameter

    approval_type=force

    to the parameters.

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

    Default

    I believe that is only needed because the user has already granted permission to the app and so Google is just re-issuing the same response each time (without the refresh token, because it wasn't asked for the first time). You could've probably made it work by having the user revoke access to the app before trying to authorize again.

    Having never authorized my sample app, I got it to work the first time, without approval_type=force. But again, that's just because I didn't already have a history of approval with Google.
    Craig Walls
    Spring Social Project Lead

  3. #13

    Default

    By using Craig's suggestion to override GoogleOAuth2Template buildAuthorizeUrl I was able to get the refreshToken. I still have one minor problem. Once the refresh token is used, the refreshToken is changed to null by the framework; after calling connection.refresh(), the refreshToken value is wiped out and there is no way to manually update the Connection object with the old reusable refreshToken before calling connectionRepository.updateConnection(connection). I want to be able to update the connection in the userconnection table to retain the old refreshToken. Is there an easy way to populate the refreshToken field without having to write extra database code to do it? Preferably I would have liked to just call a public setter method on the Connection object.

Posting Permissions

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