devbaji / vue3-google-login

Add Sign In With Google feature to your Vue 3 application
https://github.com/devbaji/vue3-google-login/
MIT License
208 stars 30 forks source link

Using slot to have a custom button changes the flow #25

Closed Frement closed 3 months ago

Frement commented 1 year ago

Customizing the button with any content changes the default flow. Callback doesn't get credential returned, instead it gets code, scope, authuser, hd and prompt.

Also it is requesting extra scopes email and profile.

This only happens when using the components slot.

bfreskura commented 1 year ago

You must handle this differently according to docs: https://yobaji.github.io/vue3-google-login/#custom-login-button

❗ For custom buttons this plugin use google.accounts.oauth2.initCodeClient and google.accounts.oauth2.initTokenClient under the hoods which gives OAuth2 authorization code and Access Token respectively in the callback response, but Google rendered login button and One Tap prompt gives a CredentialResponse with a JWT credential field, so if you are using a combination of these, validating your callback response on server-side can be a little tricky, this is more explained here