public class OAuthWebViewAuthenticator extends java.lang.Object implements Authenticator
| Constructor and Description |
|---|
OAuthWebViewAuthenticator(java.lang.String clientId,
java.lang.String clientSecret,
java.lang.String scope,
java.lang.String redirectUri)
Creates a new OAuth authentication strategy
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterAssociated() |
void |
authorize(android.webkit.WebView view,
CompletionHandler<java.lang.Void> handler)
Brings up a web-based authorization view and directs the user through the OAuth process.
|
void |
deauthorize()
Deauthorizes the current user and clears any persistent state with regards to the current user.
|
void |
getToken(CompletionHandler<java.lang.String> handler)
Returns an access token of this authenticator.
|
boolean |
isAuthorized()
Returns True if the user is logically authorized.
|
void |
refreshToken(CompletionHandler<java.lang.String> handler)
Refresh an access token of this authenticator.
|
public OAuthWebViewAuthenticator(@NonNull
java.lang.String clientId,
@NonNull
java.lang.String clientSecret,
@NonNull
java.lang.String scope,
@NonNull
java.lang.String redirectUri)
clientId - the OAuth client idclientSecret - the OAuth client secretscope - space-separated string representing which permissions the application needsredirectUri - the redirect URI that will be called when completing the authentication. This must match the redirect URI registered to your clientId.public void afterAssociated()
public boolean isAuthorized()
AuthenticatorThis may not mean the user has a valid access token yet, but the authentication strategy should be able to obtain one without further user interaction.
isAuthorized in interface AuthenticatorAuthenticatorpublic void deauthorize()
AuthenticatorPhone is registered,
it should be deregistered before calling this method.deauthorize in interface AuthenticatorAuthenticatorpublic void authorize(@NonNull
android.webkit.WebView view,
@NonNull
CompletionHandler<java.lang.Void> handler)
view - the web view for the authorization by the end user.handler - the completion handler will be called when authentication is complete, the error to indicate if the authentication process was successful.public void getToken(CompletionHandler<java.lang.String> handler)
AuthenticatorThis may involve long-running operations such as service calls, but may also return immediately. The application should not make assumptions about how quickly this completes.
getToken in interface Authenticatorhandler - a callback to be executed when completed, with the access token if successfuly retrieved, otherwise nil.Authenticatorpublic void refreshToken(CompletionHandler<java.lang.String> handler)
AuthenticatorThis may involve long-running operations such as service calls, but may also return immediately. The application should not make assumptions about how quickly this completes.
refreshToken in interface Authenticatorhandler - a callback to be executed when completed, with the access token if successfuly retrieved, otherwise nil.