2021年5月6日星期四

Nuxt auth module with Spotify

I am trying to connect to a couple social services through a Nuxt app and was starting by trying Spotify oauth2. I have the config below and it seems that the login works but user data is not returned.

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        },      },  

My method in Login

methods: {      login() {        this.$auth.loginWith('social')      },    },  

Any help on how to get the user data would be appreciated!

https://stackoverflow.com/questions/67427726/nuxt-auth-module-with-spotify May 07, 2021 at 09:04AM

没有评论:

发表评论