Class A3LSignIn
java.lang.Object
com.amazon.A3L.authentication.api.signin.A3LSignIn
Contains abstraction for GoogleSignIn
Entry point for the A3LAuth API
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic A3LSignInClient
getClient
(Activity activity, A3LSignInOptions a3LSignInOptions) Create a new instance ofA3LSignInClient
.static A3LSignInClient
getClient
(Context context, A3LSignInOptions a3LSignInOptions) Create a new instance ofA3LSignInClient
.static A3LSignInAccount
getLastSignedInAccount
(Context context) Gets the last account that the user signed in with.static com.google.android.gms.tasks.Task<A3LSignInAccount>
getSignedInAccountFromIntent
(Intent data) Method to fetch an A3LTask representing the Sign in for current intent.static boolean
hasPermissions
(A3LSignInAccount account, String... scopes) Determines if the given account has been granted permission to all given scopes.
-
Constructor Details
-
A3LSignIn
public A3LSignIn()
-
-
Method Details
-
getClient
public static A3LSignInClient getClient(@NonNull 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 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
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
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 Intent data) Method to fetch an A3LTask representing the Sign in for current intent.- Parameters:
data
- : the Intent returned viaandroid.app.Activity#onActivityResult(int, int, Intent)
when sign in completed.- Returns:
- Task: A completed Task
containing a
A3LSignInAccount
object.
-