public class AuthorizationManager
extends java.lang.Object
Constructor and Description |
---|
AuthorizationManager(Context context,
java.lang.String productId)
Create a new Auth Manager based on the supplied product id
This will throw an error if our assets/api_key.txt file, our package name, and our signing key don't match the product ID, this is
a common sticking point for the application not working
|
Modifier and Type | Method and Description |
---|---|
void |
authorizeUser(AuthorizationCallback callback)
Request authorization for the user to be able to use the application, this opens an intent that feeds back to the app:
|
static java.lang.String |
base64UrlEncode(byte[] arg)
Encode a byte array into a string, while trimming off the last characters, as required by the Amazon token server
See: http://brockallen.com/2014/10/17/base64url-encoding/
|
void |
checkLoggedIn(Context context,
AsyncCallback<java.lang.Boolean,java.lang.Throwable> callback)
Check if the user is currently logged in by checking for a valid access token (present and not expired).
|
static java.lang.String |
createCodeVerifier()
Create a new code verifier for our token exchanges
|
com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager |
getAmazonAuthorizationManager() |
static byte[] |
getHash(java.lang.String password)
Hash a string based on the SHA-256 message digest
|
public AuthorizationManager(@NotNull Context context, @NotNull java.lang.String productId)
context
- productId
- public void checkLoggedIn(Context context, AsyncCallback<java.lang.Boolean,java.lang.Throwable> callback)
context
- callback
- public void authorizeUser(AuthorizationCallback callback)
callback
- our state change callbackpublic static java.lang.String createCodeVerifier()
public static java.lang.String base64UrlEncode(byte[] arg)
arg
- our hashed stringpublic static byte[] getHash(java.lang.String password)
password
- public com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager getAmazonAuthorizationManager()