[英]How can I get access_token from auth-module, Nuxt.js
我尝试使用以下链接使用 Nuxt.js 使用 auth-module 构建 Facebook 登录。
https://github.com/nuxt-community/auth-module
我无法获得“access_token”。 代码如下。
// pages/login.vue
export default {
methods: {
this.$auth.loginWith('facebook')
}
}
回调URI是这样的。
https://localhost:3000/facebook/oauth_callback/?#access_token=***&data_access_expiration_time=1561715202&expires_in=4398&reauthorize_required_in=7776000&state=MC4xOTU3MDM2ODIxMzIzOTA5OA
// pages/facebook/oauth_callback/index.vue
<template>
<section>
<p>{{ this.$auth.$state }}</p>
<p>{{ this.$route.query }}</p
</section>
</template>
this.$auth.$state 不包括“access_token”。 我怎样才能获得“access_token”? 我也不明白为什么 URI 在获取参数字段中包含“#”。 因此,我无法从“this.$route.query”获取 access_token。
最后,我可以使用以下代码来做到这一点。
this.$auth.getToken('facebook')
谢谢大家观看。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.