我正在尝试通过 Nuxt 应用连接到几个社交服务,并从尝试 Spotify oauth2 开始。我有下面的配置,似乎登录有效,但没有返回用户数据。
modules: ['@nuxtjs/axios', '@nuxtjs/auth-next'],
auth: {
strategies: {
social: {
scheme: 'oauth2',
endpoints: {
authorization: 'https://accounts.spotify.com/authorize',
token: undefined,
logout: 'http://localhost:3000/logout',
userInfo: 'https://api.spotify.com/v1/me',
},
token: {
property: 'access_token',
type: 'Bearer',
maxAge: 1800,
},
refreshToken: {
property: 'refresh_token',
maxAge: 60 * 60 * 24 * 30,
},
responseType: 'code',
grantType: 'authorization_code',
accessType: undefined,
redirectUri: 'http://localhost:3000/dashboard/',
logoutRedirectUri: '/',
clientId: 'abc123',
scope: ['user-read-private', 'user-read-email'],
state: '',
codeChallengeMethod: '',
responseMode: '',
acrValues: '',
// autoLogout: false
},
},
我的登录方法
methods: {
login() {
this.$auth.loginWith('social')
},
},
任何有关如何获取用户数据的帮助将不胜感激!