Module auth

Index

Functions

Functions

authorize(params: { client_id?: string; immediate?: boolean; response_type?: string; scope?: any; }, callback: (token: GoogleApiOAuth2TokenObject) => any)

Initiates the OAuth 2.0 authorization process. The browser displays a popup window prompting the user authenticate and authorize. After the user authorizes, the popup closes and the callback function fires.

Parameters

  • params: { client_id?: string; immediate?: boolean; response_type?: string; scope?: any; }

    A key/value map of parameters for the request. If the key is not one of the expected OAuth 2.0 parameters, it is added to the URI as a query parameter.

  • callback: (token: GoogleApiOAuth2TokenObject) => any

    The function to call once the login process is complete. The function takes an OAuth 2.0 token object as its only parameter.

getToken(): GoogleApiOAuth2TokenObject

Retrieves the OAuth 2.0 token for the application.

Returns

GoogleApiOAuth2TokenObject

The OAuth 2.0 token.

init(callback: () => any)

Initializes the authorization feature. Call this when the client loads to prevent popup blockers from blocking the auth window on gapi.auth.authorize calls.

Parameters

  • callback: () => any

    A callback to execute when the auth feature is ready to make authorization calls.

setToken(token: GoogleApiOAuth2TokenObject)

Sets the OAuth 2.0 token for the application.

Parameters