public class Authenticator
extends java.lang.Object
Constructor and Description |
---|
Authenticator(java.lang.String twitchBaseUrl) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitAccessToken()
Listens for callback from twitch server with the access token.
|
java.lang.String |
getAccessToken() |
AuthenticationError |
getAuthenticationError()
Get the authentication error if it failed.
|
java.lang.String |
getAuthenticationUrl(java.lang.String clientId,
java.net.URI redirectURI,
Scopes... scopes)
Returns the authentication URL that you can redirect the user to in order
to authorize your application to access their account and retrieve an
access token.
|
java.lang.String |
getClientId() |
java.net.URI |
getRedirectUri() |
boolean |
hasAccessToken()
Check if an access token has been received.
|
boolean |
hasAuthenticationError()
Check if there was an authentication error.
|
void |
setAccessToken(java.lang.String accessToken) |
public java.lang.String getAuthenticationUrl(java.lang.String clientId, java.net.URI redirectURI, Scopes... scopes)
clientId
- the Twitch application client IDredirectURI
- the redirect URI for your Twitch applicationscopes
- the scopes needed for your applicationpublic boolean awaitAccessToken()
getAuthenticationUrl()
must be called prior to this function!true
if access token was received, false
otherwisepublic java.lang.String getClientId()
public java.net.URI getRedirectUri()
public java.lang.String getAccessToken()
public void setAccessToken(java.lang.String accessToken)
public boolean hasAccessToken()
true
if an access token has been received; false
otherwisepublic AuthenticationError getAuthenticationError()
AuthenticationError
if authentication failed. null
otherwisepublic boolean hasAuthenticationError()
true
if an error exists; false
otherwise