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

Plugin name #521

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const { signIn, loaded } = useGoogleLogin({
responseType,
jsSrc,
onRequest,
prompt
prompt,
pluginName
})
```
## Logout Hook
Expand Down Expand Up @@ -168,6 +169,7 @@ Use GoogleLogout button to logout the user from google.
| redirectUri | string | - | If using ux_mode='redirect', this parameter allows you to override the default redirect_uri that will be used at the end of the consent flow. The default redirect_uri is the current URL stripped of query parameters and hash fragment. |
| isSignedIn | boolean | false | If true will return GoogleUser object on load, if user has given your app permission |
| render | function | - | Render prop to use a custom element, use renderProps.onClick |
| pluginName | string | - | Enables legacy use for new client IDs created before July 29th 2022, as described here (https://developers.google.com/identity/sign-in/web/reference) |
Google Scopes List: [scopes](https://developers.google.com/identity/protocols/googlescopes)

## Logout Props
Expand Down
9 changes: 6 additions & 3 deletions src/google-login.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const GoogleLogin = props => {
accessType,
responseType,
jsSrc,
prompt
prompt,
pluginName
} = props

const { signIn, loaded } = useGoogleLogin({
Expand All @@ -60,7 +61,8 @@ const GoogleLogin = props => {
accessType,
responseType,
jsSrc,
prompt
prompt,
pluginName
})
const disabled = disabledProp || !loaded

Expand Down Expand Up @@ -169,7 +171,8 @@ GoogleLogin.propTypes = {
accessType: PropTypes.string,
render: PropTypes.func,
theme: PropTypes.string,
icon: PropTypes.bool
icon: PropTypes.bool,
pluginName: PropTypes.string
}

GoogleLogin.defaultProps = {
Expand Down
6 changes: 4 additions & 2 deletions src/use-google-login.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const useGoogleLogin = ({
accessType,
responseType,
jsSrc = 'https://apis.google.com/js/api.js',
prompt
prompt,
pluginName
}) => {
const [loaded, setLoaded] = useState(false)

Expand Down Expand Up @@ -90,7 +91,8 @@ const useGoogleLogin = ({
ux_mode: uxMode,
redirect_uri: redirectUri,
scope,
access_type: accessType
access_type: accessType,
plugin_name: pluginName
}

if (responseType === 'code') {
Expand Down