Class A3LSignIn
- java.lang.Object
-
- com.amazon.A3L.authentication.api.signin.A3LSignIn
-
public class A3LSignIn extends java.lang.Object
Contains abstraction for GoogleSignIn Entry point for the A3LAuth API
-
-
Constructor Summary
Constructors Constructor Description A3LSignIn()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static A3LSignInClient
getClient(android.app.Activity activity, A3LSignInOptions a3LSignInOptions)
Create a new instance ofA3LSignInClient
.static A3LSignInClient
getClient(android.content.Context context, A3LSignInOptions a3LSignInOptions)
Create a new instance ofA3LSignInClient
.static A3LSignInAccount
getLastSignedInAccount(android.content.Context context)
Gets the last account that the user signed in with.static com.google.android.gms.tasks.Task<A3LSignInAccount>
getSignedInAccountFromIntent(android.content.Intent data)
Method to fetch an A3LTask representing the Sign in for current intent.static boolean
hasPermissions(A3LSignInAccount account, java.lang.String... scopes)
Determines if the given account has been granted permission to all given scopes.
-
-
-
Method Detail
-
getClient
public static A3LSignInClient getClient(@NonNull android.content.Context context, @NonNull A3LSignInOptions a3LSignInOptions)
Create a new instance ofA3LSignInClient
. Fetches client according to the current service chosen, AppAuth or Google. While in both cases A3LSignInClient is returned, the object contains Google or AppAuth clients depending on the current service.- Parameters:
context
- : A Context used to provide information about the application's environment.a3LSignInOptions
- : AA3LSignInOptions
used to configure theA3LSignInClient
. It is recommended to build out aA3LSignInOptions
starting with newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
), configuring ID token in options if you have a server and adding all the scopes needed inA3LSignInOptions.Builder.requestScopes(Scope, Scope...)
.- Returns:
- A3LSignInClient: A instance of
A3LSignInClient
-
getClient
public static A3LSignInClient getClient(@NonNull android.app.Activity activity, @NonNull A3LSignInOptions a3LSignInOptions)
Create a new instance ofA3LSignInClient
. Fetches client according to the current service chosen, AppAuth or Google. While in both cases A3LSignInClient is returned, the object contains Google or AppAuth clients depending on the current service.- Parameters:
activity
- : An Activity that will be used to manage the lifecycle of the GoogleSignInClient.a3LSignInOptions
- : AA3LSignInOptions
used to configure theA3LSignInClient
. It is recommended to build out aA3LSignInOptions
starting with newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
), configuring ID token in options if you have a server and adding all the scopes needed inA3LSignInOptions.Builder.requestScopes(Scope, Scope...)
.- Returns:
- A3LSignInClient: A instance of
A3LSignInClient
-
getLastSignedInAccount
public static A3LSignInAccount getLastSignedInAccount(@NonNull android.content.Context context)
Gets the last account that the user signed in with.- Parameters:
context
- : A Context used to provide information about the application's environment.- Returns:
- A3LSignInAccount:
A3LSignInAccount
from last known successful sign-in. If user has never signed in before or has signed out / revoked access, null is returned
-
hasPermissions
public static boolean hasPermissions(@NonNull A3LSignInAccount account, @NonNull java.lang.String... scopes)
Determines if the given account has been granted permission to all given scopes.- Parameters:
account
- : theA3LSignInAccount
to be checkedscopes
- : the collection of scopes to be checked.- Returns:
- boolean: true if the given account has been granted permission to all given scopes.
-
getSignedInAccountFromIntent
public static com.google.android.gms.tasks.Task<A3LSignInAccount> getSignedInAccountFromIntent(@NonNull android.content.Intent data)
Method to fetch an A3LTask representing the Sign in for current intent.- Parameters:
data
- : the Intent returned viaActivity.onActivityResult(int, int, Intent)
when sign in completed.- Returns:
- Task: A completed Task
containing a
A3LSignInAccount
object.
-
-