Class A3LSignInAccount
- java.lang.Object
-
- com.amazon.A3L.authentication.api.signin.A3LSignInAccount
-
- All Implemented Interfaces:
android.os.Parcelable
public class A3LSignInAccount extends java.lang.Object implements android.os.Parcelable
Contains the details of currently Signed In Account details.
-
-
Field Summary
Fields Modifier and Type Field Description static android.os.Parcelable.Creator<A3LSignInAccount>
CREATOR
Creator used for fetching data from the parcel received by an activity
-
Constructor Summary
Constructors Constructor Description A3LSignInAccount(org.json.JSONObject accountDetails)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
describeContents()
Needed for Parcellingboolean
equals(java.lang.Object obj)
Overridden method to verify if the current A3LSignInObject and the one requested have same data.android.accounts.Account
getAccount()
A convenient wrapper forgetEmail()
which returns anAccount
object.java.lang.String
getDisplayName()
Returns the display name of the signed in user if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestProfile()
configured; null otherwise.java.lang.String
getEmail()
Returns the email address of the signed in user ifA3LSignInOptions.Builder.requestEmail()
was configured; null otherwise.java.lang.String
getFamilyName()
Returns the family name of the signed in user if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestProfile()
configured; null otherwise.java.lang.String
getGivenName()
Returns the given name of the signed in user if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestProfile()
configured; null otherwise.java.util.Set<Scope>
getGrantedScopes()
Returns all scopes that have been authorized to your application.java.lang.String
getId()
Returns the unique ID for the Google account if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestId()
configured; null otherwise.java.lang.String
getIdToken()
Returns an ID token that you can send to your server ifA3LSignInOptions.Builder.requestIdToken(String)
was configured; null otherwise.android.net.Uri
getPhotoUrl()
Returns the photo url of the signed in user if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestProfile()
configured; null otherwise.java.util.Set<Scope>
getRequestedScopes()
Returns all scopes that have been requested by your application.int
hashCode()
void
writeToParcel(android.os.Parcel parcel, int flags)
Helps in parcelling the Account.
-
-
-
Field Detail
-
CREATOR
public static final android.os.Parcelable.Creator<A3LSignInAccount> CREATOR
Creator used for fetching data from the parcel received by an activity
-
-
Method Detail
-
getDisplayName
public java.lang.String getDisplayName()
Returns the display name of the signed in user if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestProfile()
configured; null otherwise. Not guaranteed to be present for all users, even when configured.- Returns:
- String: Display Name of the account
-
getEmail
public java.lang.String getEmail()
Returns the email address of the signed in user ifA3LSignInOptions.Builder.requestEmail()
was configured; null otherwise. Applications should not key users by email address since a Google account's email address can change. UsegetId()
as a key instead. Important: Do not use this returned email address to communicate the currently signed in user to your backend server. Instead, send an ID tokenA3LSignInOptions.Builder.requestIdToken(String)
, which can be securely validated on the server- Returns:
- String: Email of the account
-
getFamilyName
public java.lang.String getFamilyName()
Returns the family name of the signed in user if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestProfile()
configured; null otherwise. Not guaranteed to be present for all users, even when configured.- Returns:
- String: Family Name of the account
-
getGivenName
public java.lang.String getGivenName()
Returns the given name of the signed in user if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestProfile()
configured; null otherwise. Not guaranteed to be present for all users, even when configured.- Returns:
- String: Given Name of the account
-
getId
public java.lang.String getId()
Returns the unique ID for the Google account if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestId()
configured; null otherwise. This is the preferred unique key to use for a user record. Important: Do not use this returned email address to communicate the currently signed in user to your backend server. Instead, send an ID tokenA3LSignInOptions.Builder.requestIdToken(String)
, which can be securely validated on the server.- Returns:
- String: Id representing the Google Account
-
getIdToken
public java.lang.String getIdToken()
Returns an ID token that you can send to your server ifA3LSignInOptions.Builder.requestIdToken(String)
was configured; null otherwise. ID token is a JSON Web Token signed by Google that can be used to identify a user to a backend.- Returns:
- String: Id token of the user
-
getPhotoUrl
public android.net.Uri getPhotoUrl()
Returns the photo url of the signed in user if you built your configuration starting from newA3LSignInOptions.Builder
(A3LSignInOptions.DEFAULT_SIGN_IN
) or withA3LSignInOptions.Builder.requestProfile()
configured; null otherwise. Not guaranteed to be present for all users, even when configured.- Returns:
- Uri: Display Picture URI
-
getAccount
public android.accounts.Account getAccount()
A convenient wrapper forgetEmail()
which returns anAccount
object.- Returns:
- account:
Account
-
getRequestedScopes
public java.util.Set<Scope> getRequestedScopes()
Returns all scopes that have been requested by your application.- Returns:
- Set: A set of all scopes those were requested by the app.
-
getGrantedScopes
public java.util.Set<Scope> getGrantedScopes()
Returns all scopes that have been authorized to your application. This can be a larger set than what you have requested viaA3LSignInOptions
larger due to other scope handling logic.- Returns:
- Set: A set of all scopes those were granted to the app.
-
describeContents
public int describeContents()
Needed for Parcelling- Specified by:
describeContents
in interfaceandroid.os.Parcelable
- Returns:
- int: 0
-
writeToParcel
public void writeToParcel(android.os.Parcel parcel, int flags)
Helps in parcelling the Account. This lets the A3LSignInAccount object to be transferred between activities as needed. Flags values can be 0, PARCELABLE_WRITE_RETURN_VALUE or PARCELABLE_ELIDE_DUPLICATES- Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
- Parameters:
parcel
- : Parcel consisting of the A3LSignInAccountflags
- : Additional flags about how the object should be written.
-
equals
public boolean equals(java.lang.Object obj)
Overridden method to verify if the current A3LSignInObject and the one requested have same data.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- : A3LSignInAccount- Returns:
- boolean: true if both objects have same information
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-