Announcement Announcement Module
Collapse
No announcement yet.
Reuse of tokens by OAuth2 client Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reuse of tokens by OAuth2 client

    I have a web application which is acting as OAuh2 client to access google apis. Is there a way I can store the tokens and reuse them ? I see that there is org.springframework.security.oauth2.client.token.C lientTokenServices interface available. Can a class implementing this service be used to save a and retrieve the tokens? If so how to configure that ?

    At present once user logs out from web app and comes back to web application, permission page from google is shown again. I would like to avoid this and reuse the token till it expires.

    My resource configuration looks like below, I have modified client-id, client-secret and pre-established-redirect-uri
    Code:
    <oauth:resource id="cloudfiles" type="authorization_code"
    		client-id="my client id" client-secret="my secret"
    		access-token-uri="https://accounts.google.com/o/oauth2/token"
    		user-authorization-uri="https://accounts.google.com/o/oauth2/auth"
    		scope="https://www.googleapis.com/auth/userinfo.email"
    		client-authentication-scheme="form" pre-established-redirect-uri="http://my webapp" />
    I am using 1.0.3.RELEASE version of spring-security-oauth2

  • #2
    AccessTokenProvider chain has a setter for ClientTokenServices, and an AccessTokenProviderChain is used by OAuth2RestTemplate, so the idea is that you inject it there I think (e.g. <rest-template access-token-provider="mytokenprovider"/>).

    Comment


    • #3
      That is working ! Thank you !

      Comment

      Working...
      X