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

Add support for multiple login buttons with different scopes + minor naming change - #494

Open
eliranamar wants to merge 1 commit into
anthonyjgrove:masterfrom
eliranamar:multi-button-scopes
Open

Add support for multiple login buttons with different scopes + minor naming change#494
eliranamar wants to merge 1 commit into
anthonyjgrove:masterfrom
eliranamar:multi-button-scopes

Conversation

@eliranamar

Copy link
Copy Markdown

The main change is not loading the scope passed via props when calling window.gapi.auth2.init. instead let gapi load the default base scope (email profile), and when calling signIn method, add the required scopes if passed from props.
This is helpful when using multiple buttons with different scopes.
Currently once gapi is loaded with 1 set of scope, then the same scope will be requested on every GoogleLogin instance.

Our specific use case was to add an offline access for google analytics in 1 place, and google ads access in another.

Comment thread README.md
| clientId | string | REQUIRED | You can create a clientID by creating a [new project on Google developers website.](https://developers.google.com/identity/sign-in/web/sign-in) |
| jsSrc | string | https://apis.google.com/js/api.js | URL of the Javascript file normally hosted by Google |
| hostedDomain | string | - | The G Suite domain to which users must belong to sign in |
| scope | string | profile email | Base scopes requested, Passing `scope` prop will be added additionally to `profile email`. Passing none will request only `profile email` |

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please view this file diff in rich text mode

@advance512

Copy link
Copy Markdown

lgtm

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.

2 participants