I am using Spring Oauth2.0
using Google as authorization provider. I have the following configuration in my application.yml
file
security:
oauth2:
client:
clientId: xxxxxxxxxxxxxxxxxxxx
clientSecret: xxxxxxxxxxxxxxxxxx
accessTokenUri: https://accounts.google.com/o/oauth2/token
userAuthorizationUri: https://accounts.google.com/o/oauth2/auth
authenticationScheme: query
clientAuthenticationScheme: query
scope: https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile
resource:
userInfoUri: https://www.googleapis.com/oauth2/v3/userinfo
preferTokenInfo: false
And this is my main class
@SpringBootApplication
@EnableOAuth2Sso
public class App
{
public static void main(String[] args) throws Exception {
SpringApplication.run(App.class, args);
}
@Bean public RequestContextListener requestContextListener(){
return new RequestContextListener();
}
}
After this I need to access google api to get some user info but that requires an access token. Where does Spring store this token? How can I retrieve it? Thanks in advance !!