如何将 access_token as 直接传递给 nuxt/auth 包
How to pass the access_token as directly to the nuxt/auth package
如何将 access_token
传递到 nuxt/auth
包中的 user
端点,同时直接获得 access_token as 而无需任何用户名和密码,我不想要由于 access_token 已经在 user
端点之前调用 login
,我只想调用用户点,最后我如何传递 access_token
并调用 user
端点直接?
非常感谢您的帮助!
// Auth module
auth: {
plugins: [
{ src: '~/plugins/auth' }
],
redirect: {
login: '/login',
logout: '/',
home: false
},
strategies: {
local: {
endpoints: {
login: { url: 'account/token', propertyName: 'result.access_token' },
logout: { url: 'account/logout' },
user: { url: 'account/self', propertyName: 'result' }
}
}
}
}
要设置令牌,您可以使用 this.$auth.setToken(...)
。要调用用户端点,您可以使用 this.$auth.fetchUser()
。
如何将 access_token
传递到 nuxt/auth
包中的 user
端点,同时直接获得 access_token as 而无需任何用户名和密码,我不想要由于 access_token 已经在 user
端点之前调用 login
,我只想调用用户点,最后我如何传递 access_token
并调用 user
端点直接?
非常感谢您的帮助!
// Auth module
auth: {
plugins: [
{ src: '~/plugins/auth' }
],
redirect: {
login: '/login',
logout: '/',
home: false
},
strategies: {
local: {
endpoints: {
login: { url: 'account/token', propertyName: 'result.access_token' },
logout: { url: 'account/logout' },
user: { url: 'account/self', propertyName: 'result' }
}
}
}
}
要设置令牌,您可以使用 this.$auth.setToken(...)
。要调用用户端点,您可以使用 this.$auth.fetchUser()
。