Interface GoogleSignInManager

Error codes of the ApiException:

  • 12500: Sign in failed
  • 12501: Sign in cancelled
  • 12502: Sign in currently in progress
interface GoogleSignInManager {
    getLastSignedInAccount(): null | GoogleSignInAccount;
    revokeAccess(): Promise<void>;
    signIn(): Promise<null | GoogleSignInAccount>;
    signOut(): Promise<void>;
    silentSignIn(): Promise<null | GoogleSignInAccount>;
}

Methods

  • Revokes access given to the current application. Future sign-in attempts will require the user to re-consent to all requested scopes. Applications are required to provide users that are signed in with Google the ability to disconnect their Google account from the app. If the user deletes their account, you must delete the information that your app obtained from the Google APIs.

    Returns Promise<void>

  • Starts the sign-in flow.

    The returned promise is rejected if an error occurs during sign in.

    Note: This operation requires the user interaction, consider using ActivityManager.runUserInteraction to ensure that consequent UI-related operations are suspended until this one is completed.

    Returns Promise<null | GoogleSignInAccount>

    The account of the signed-in user or null if user cancelled the sign in.

  • Signs out the current signed-in user if any. It also clears the account previously selected by the user and a future sign in attempt will require the user pick an account again.

    Returns Promise<void>

  • Returns the account information for the user who is signed in to this app. If no user is signed in, try to sign the user in without displaying any user interface.

    The account will possibly contain an ID token which may be used to authenticate and identify sessions that you establish with your application servers. If you use the ID token expiry time to determine your session lifetime, you should retrieve a refreshed ID token, by calling silentSignIn prior to each API call to your application server.

    Calling silentSignIn can also help you detect user revocation of access to your application on other platforms, and you can call signIn again to ask the user to re-authorize.

    If your user has never previously signed in to your app on the current device, we can still try to sign them in, without displaying user interface, if they have signed in on a different device.

    We attempt to sign users in if there is one and only one matching account on the device that has previously signed in to your application, and if the user previously granted all the scopes your app is requesting for this sign in.

    Returns Promise<null | GoogleSignInAccount>

    The account of the signed-in user or null if user cannot be signed in is silently.