我正在开发一个类似于 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)