使用@nuxtjs/auth-next 与谷歌登录

问题描述 投票:0回答:0

我正在使用“@nuxtjs/auth-next”:“5.0.0-1667386184.dfbbb54”进行身份验证。我在 nuxt.config.js 中设置了以下策略

google: {
          scheme: 'oauth2',
          endpoints: {
            authorization: 'https://accounts.google.com/o/oauth2/auth',
            token: 'https://oauth2.googleapis.com/token',
            userInfo: 'https://www.googleapis.com/oauth2/v3/userinfo'
          },
          codeChallengeMethod: '',
          responseType: 'token id_token',
          clientId: 'CLIENT ID'
          redirectUri: 'http://localhost:3000',
          scope: ['https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email']
        }
      }

在我点击使用谷歌登录后,谷歌发出请求并重定向到 redirectUri,查询附加为

https://localhost:3000/fr_fr#state=3uCrLK9TC8&code=4/0AVHEtk6PNtbN6mpmx-WxL-Fodgx7h7Rcuw-Zs63KpAryA2GA6nJDH5VC6A_3EbUXAWblwA&access_token=ya29.a0Ael9sCN1gFYfoZEr1OPUVBeiKQU_aMlgT1-kEmJ90_uJy2TobT_pSy-Ib0McqcA4xmMSvnY0Hqg0w_O1w96E1Axa7vJdDi-wCKp5Ywb6XNU0ePJqTI0BhuSUuM7tFF_uTlHj7votVK5txIR8e9gkwj50yjwYaCgYKAXASARISFQF4udJhPTtEqzlvE158n9CW-FDYzg0163&token_type=Bearer&expires_in=3599&scope=email%20profile%20openid%20https:/www.googleapis.com/auth/userinfo.email%20https:/www.googleapis.com/auth/userinfo.profile&id_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjFhYWU4ZDdjOTIwNThiNWVlYTQ1Njg5NWJmODkwODQ1NzFlMzA2ZjMiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiYXpwIjoiNzQ..........

状态也为空,loggedIn 未定义

loggedIn :undefined
state: {
 strategy: 'google'
}

我做错了什么?

vue.js nuxt.js google-signin nuxt-auth
© www.soinside.com 2019 - 2024. All rights reserved.