Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@buttercup/google-oauth2-client

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@buttercup/google-oauth2-client

Google OAuth2 authentication client

latest
Source
npmnpm
Version
2.2.0
Version published
Maintainers
2
Created
Source

Google OAuth2 Client

Minimal compatibility-first Google OAuth2 client implementation

Buttercup npm version Tests status

About

This library is a minimal implementation of the google-auth-library project, designed to be compatible with NodeJS, the browser and React Native. The google-auth-library package has had problems with compatibility in this regard and rather than wait for that to get sorted, this library was released to solve the exact problem without the overhead of project politics, wait times and package excess (extra features not needed that are causing the incompatibilities in the first place).

This library is targeted at NodeJS but should work everywhere.

Usage

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

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

import { OAuth2Client } from "@buttercup/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

Keywords

google

FAQs

Package last updated on 11 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts