Use the browser.identity API to get OAuth2 access tokens.

Permissions: identity

Not allowed in: Content scripts, Devtools pages

_GetAuthTokenDetails
_GetProfileUserInfoReturnUserinfo
_LaunchWebAuthFlowDetails
_RemoveCachedAuthTokenDetails
_RemoveCachedAuthTokenReturnUserinfo
AccountInfo
onSignInChanged
getAccounts
getAuthToken
getProfileUserInfo
getRedirectURL
launchWebAuthFlow
removeCachedAuthToken
onSignInChanged:
    | WebExtEvent<(account: AccountInfo, signedIn: boolean) => void>
    | undefined

Fired when signin state changes for an account on the user's profile.

Unsupported on Firefox at this time.

  • Retrieves a list of AccountInfo objects describing the accounts present on the profile.

    Returns Promise<AccountInfo[]>

    Unsupported on Firefox at this time.

  • Gets an OAuth2 access token using the client ID and scopes specified in the oauth2 section of manifest.json.

    Parameters

    Returns Promise<string>

    Unsupported on Firefox at this time.

  • Generates a redirect URL to be used in |launchWebAuthFlow|.

    Parameters

    • Optionalpath: string

      The path appended to the end of the generated URL.

    Returns string

  • Starts an auth flow at the specified URL.

    Parameters

    Returns Promise<string>