0.0.3 • Published 3 years ago

@idsync/google-oauth2-client v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Google OAuth2 Client

Minimal compatibility-first Google OAuth2 client implementation

Usage

Install by running npm install @idsync/google-oauth2-client --save.

Import the OAuth2Client class to get started, similarly to the original implemenation:

import { OAuth2Client } from "@idsync/google-oauth2-client";

const client = new OAuth2Client(
    "my-client-id",
    "my-client-secret",
    "http://redirect.uri"
);

const authURL = client.generateAuthUrl(/* ... */);

Implemented features

The following methods are implemented:

MethodExampleDescription
generateAuthUrlgenerateAuthUrl({ access_type: "offline", prompt: "consent", scope: "profile" })Generate an authorisation URL
exchangeAuthCodeForTokenawait exchangeAuthCodeForToken(authCode)Get the tokens for an authorisation code
refreshAccessTokenawait refreshAccessToken(refreshToken)Refresh the tokens