Skip to content
This repository was archived by the owner on Sep 21, 2023. It is now read-only.

feature: add 'addScopes' to useGoogleLogin hook to support incremental scopes - #455

Open
flandrade wants to merge 6 commits into
anthonyjgrove:masterfrom
flandrade:incremental-scopes
Open

flandrade wants to merge 6 commits into
anthonyjgrove:masterfrom
flandrade:incremental-scopes

Conversation

@flandrade

@flandrade flandrade commented Jun 1, 2021 •

Copy link
Copy Markdown

Google Sign-In allows requesting additional permissions as described in the official documentation. In this PR, I follow the proposed approach in #348:

The useGoogleLogin hook exposes the new addScopes method. This hook also supports two new callbacks, onAddScopesSuccess and onAddScopesFailure, to handle the method response:

import { useGoogleLogin } from 'react-google-login'

const { addScopes } = useGoogleLogin({
  clientId,
  onAddScopesSuccess,
  onAddScopesSuccess
})

NOTE: Since there are two accessType to authorize scopes: online and offline. The addScopes method will use user.grant(options) or auth.grantOfflineAccess(options). This method would be only executed if the user is logged in.

This PR is for #348 and #371.

@flandrade flandrade changed the title feature: add 'addScopes' to useGoogleLogout hook to support incremental scopes feature: add 'addScopes' to useGoogleLogin hook to support incremental scopes Jun 1, 2021

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant