我给出的范围是什么,我只获得 users.read tweet.readoffline.access 范围,例如来自 twitter 的 url https://x.com/i/oauth2/authorize?scope=users.read+tweet.read+offline .访问.
这是我检查过的代码https://github.com/nextauthjs/next-auth/discussions/4251并尝试根据它来实现,但它不起作用。无论我做什么,只有三个范围可用。
import TwitterProvider from 'next-auth/providers/twitter';
export const config = {
debug: true,
pages: {
signIn: '/sign-up',
},
providers: [
TwitterProvider({
//@ts-ignore
version: '2.0', // opt-in to Twitter OAuth 2.0
authorization: {
url: 'https://x.com/i/oauth2/authorize',
params: {
scope: 'users.read tweet.read tweet.write offline.access',
},
profile(profile) {
return {
id: profile.data.id,
name: profile.data.name,
image: profile.data.profile_image_url,
email: profile.data.email,
username: profile.data.username,
};
},
}),
],
我也面临这个问题,当我在 auth.js 的 node_modules 中看到 twitter.js 文件时,发现授权 URL 是用此 URL 字符串硬编码的 https://x.com/i/oauth2/authorize?scope=users。阅读 推文. 离线阅读. 访问 要修复它,请按照我的步骤操作。