我正在尝试添加一个 Twitter 授权按钮,让我获得用户 oauth_token 和 oauth_token_secret,这允许我们的工具代表用户执行操作。
import NextAuth from "next-auth";
import TwitterProvider from "next-auth/providers/twitter";
export const authOptions = {
// Configure one or more authentication providers
providers: [
TwitterProvider({
clientId: process.env.TWITTER_CLIENT_ID,
clientSecret: process.env.TWITTER_CLIENT_SECRET,
version: "2.0", // opt-in to Twitter OAuth 2.0
authorization: {
url: "https://twitter.com/i/oauth2/authorize",
params: {
grant_type: "authorization_code",
scope: "users.read tweet.read tweet.write like.read list.read",
},
},
}),
// ...add more providers here
],
session: {
strategy: "jwt",
},
callbacks: {
jwt: ({ token, account, ...props }) => {
console.log({ …Run Code Online (Sandbox Code Playgroud)