小编fas*_*sil的帖子

如何使用Next-auth同时存储多个会话

我正在开发一个类似于 Zappier 的集成工具。我想使用 Next-auth 连接到一个或多个应用程序并保存其访问令牌。但是,Next-auth 一次仅允许一个会话。如何使用 Next-auth 一次存储多个会话?

export const authOptions = {
  // Configure one or more authentication providers
  secret: 'tsfsdf',
  providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_CLIENT_ID,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET,
      authorization: {
        params: {
          scope: 'openid https://www.googleapis.com/auth/gmail.compose https://www.googleapis.com/auth/gmail.modify'
        }
      }
    }),
    {
      clientId: process.env.QUICK_BOOKS_CLIENT_ID,
      clientSecret: process.env.QUICK_BOOKS_CLIENT_SECRET,
      id: 'quickbooks',
      name: 'QuickBooks',
      type: 'oauth',
      wellKnown: 'https://developer.api.intuit.com/.well-known/openid_sandbox_configuration',
      authorization: { params: { scope: 'com.intuit.quickbooks.accounting openid profile email phone address' } },
      idToken: true,
      checks: ['pkce', 'state'],
      profile(profile) {
        console.log(profile, 'profile')
        return {
          id: profile.sub,
          name: …
Run Code Online (Sandbox Code Playgroud)

reactjs next.js next-auth

5
推荐指数
0
解决办法
1432
查看次数

标签 统计

next-auth ×1

next.js ×1

reactjs ×1