Options
All
  • Public
  • Public/Protected
  • All
Menu

External module chrome/auth

Google Oauth2.0 utilities https://developer.chrome.com/apps/identity

Index

Variables

Const chromep

chromep: ChromePromise = new ChromePromise()

Functions

getToken

  • getToken(interactive?: boolean, scopes?: string[]): Promise<string>
  • Get an OAuth2.0 token

    remarks

    Note: Every time you use a different scopes array, you will get a new token the first time, so you need to always get it with those scopes and remove the cached one with the scopes.

    throws

    An error if we failed to get token

    Parameters

    • Default value interactive: boolean = false

      if true may block

    • Optional scopes: string[]

      optional scopes to use, overrides those in the manifest

    Returns Promise<string>

    An access token

isRevoked

  • isRevoked(): Promise<boolean>
  • Has our authorization been revoked (or not granted) for the default scopes

    Returns Promise<boolean>

    true if no valid token

isSignedIn

  • isSignedIn(): Promise<boolean>
  • Is a user signed in to Chrome

    Returns Promise<boolean>

    true if signed in

removeCachedToken

  • removeCachedToken(interactive?: boolean, curToken?: string | null, scopes?: string[]): Promise<null | string>
  • Remove a cached OAuth2.0 token

    throws

    An error if we failed to remove token

    Parameters

    • Default value interactive: boolean = false

      if true may block

    • Default value curToken: string | null = ""

      token to remove

    • Optional scopes: string[]

      optional scopes to use, overrides those in the manifest

    Returns Promise<null | string>

    The old token

Generated using TypeDoc