Skip to content

Commit

Permalink
Update Google Provider example to be functional
Browse files Browse the repository at this point in the history
Currently the Google Provider example will always fail due to checking for `email_verified` when the correct response from the server is `verified_email`

next-auth debug output for validation:

```
[next-auth][debug][profile_data] {
  id: 'XXXXXXX',
  email: 'nick@example',
  verified_email: true,
  name: 'Nick Parks',
  given_name: 'Nick',
  family_name: 'XXXX',
  picture: 'XXXX,
  locale: 'en',
  hd: 'example.com'
}
```
  • Loading branch information
NickParks authored and iaincollins committed Aug 6, 2020
1 parent 92f53c5 commit 1cc31de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions www/docs/providers/google.md
Expand Up @@ -51,7 +51,7 @@ const options = {
:::

:::tip
Google also return an `email_verified` boolean property in the OAuth profile.
Google also return an `verified_email` boolean property in the OAuth profile.

You can use this property to restrict access to people with verified accounts at a particular domain.

Expand All @@ -61,7 +61,7 @@ const options = {
callbacks: {
signIn: async (user, account, profile) => {
if (account.provider === 'google' &&
profile.email_verified === true &&
profile.verified_email === true &&
profile.email.endsWith('@example.com')) {
return Promise.resolve(true)
} else {
Expand Down

1 comment on commit 1cc31de

@vercel
Copy link

@vercel vercel bot commented on 1cc31de Aug 6, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.