public class OAuth2Authenticator extends Object
OAuth2Authenticator oauth = new OAuth2Authenticator();
AuthUrlResponse authResponse = oauth.getAuthUrl();
The authResponse contains link which user has to type into the browser. Then he has to enter
userCode.
After he has done that we can use the deviceCode to retrieve access and refresh tokens:
System.out.println(oauth.getAccessGoogleTokens(authResponse.getDeviceCode()));
[1] https://developers.google.com/accounts/docs/OAuth2ForDevicesConstructor and Description |
---|
OAuth2Authenticator() |
Modifier and Type | Method and Description |
---|---|
OAuth2Tokens |
getAccessGoogleTokens(String deviceCode)
Use this method to retrieve access tokens when you think user has already authorized the
request.
|
AuthUrlResponse |
getAuthUrl()
AuthUrl is url that user has to type into his browser.
|
OAuth2Tokens |
refreshToken(OAuth2Tokens at) |
public AuthUrlResponse getAuthUrl()
public OAuth2Tokens getAccessGoogleTokens(String deviceCode)
deviceCode
- public OAuth2Tokens refreshToken(OAuth2Tokens at)
new
- immutable instance of OAuth2TokensCopyright © 2016 JBoss by Red Hat. All rights reserved.