Search code examples
javaoauthscribe

Scribe - don't ask for permission when the application has already been accepted


I'm using Scribe for login with google and Twitter. It works nicely, but I would like to allow the application to connect directly without the user's intervention if he already accepted it.

Is it possible with Scribe ? If yes, how can I do that ?


Solution

  • Yes. You can save the access_token and access_token_secret anywhere (db, key-value storage, session, etc) and use them until they expire (they are longlived for most providers).

    EDIT (answer to the comments)

    I guess you have a way of identifying your users, assuming this is called user_id, I'd store it in a persistent medium (not a session), something like this:

    user_id

    access_token

    access_token_secret

    Then, fetch the token and secret from the medium, and re-create the token with:

    new Token(access_token, access_token_secret);