小编Ped*_*lho的帖子

next-auth 中弹出登录

是否可以在下一个身份验证的弹出窗口中进行社交登录?或者只能重定向到提供商身份验证页面?

我这样问是因为我不想在重定向到提供程序页面后丢失所有应用程序状态。

我不想将内容保存在数据库或浏览器存储中。


export default NextAuth({
  // Configure one or more authentication providers
  providers: [
    Providers.Facebook({
      clientId: process.env.FACEBOOK_ID,
      clientSecret: PROCESS.ENV.FACEBOOK_SECRET
    }),
    Providers.Google({
      clientId: process.env.GOOGLE_ID,
      clientSecret: process.env.GOOGLE_SECRET,
      authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth?prompt=consent&access_type=offline&response_type=code',
    }),
    Providers.Credentials({
      name: "credentials",
      async authorize(credentials, req) {
        const user = { email: req.body.email }
        return user
      },
    }),
    // ...add more providers here
  ],
  jwt: {
    signingKey: process.env.SIGNINING_KEY,
  },
  callbacks: {
    async signIn(user, account) {
      const { name, email } = user;
      const { provider } = account
  
      try {
        
        
        // …
Run Code Online (Sandbox Code Playgroud)

oauth reactjs next.js next-auth

15
推荐指数
2
解决办法
6963
查看次数

标签 统计

next-auth ×1

next.js ×1

oauth ×1

reactjs ×1