我尝试使用auth-module和Nuxt.js下面的链接建立Facebook登录。
https://github.com/nuxt-community/auth-module
我无法获得“ access_token”。代码如下。
.background-wrap{
z-index:-1000;
width:100%;
height:100%;
overflow:hidden;
top:0;
left:0;
}
#video-bg-elem{
top:0;
left:0;
min-width:100%;
min-height:100%;
}
.item-1{
top:0;
left:0;
width:100%;
min-height:100%;
z-index:-1000;
animation-duration: 9s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-name: anim-1;
}
.item-2{
top:0;
left:0;
width:100%;
min-height:100%;
z-index:-1000;
animation-duration: 6s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-name: anim-2;
}
@keyframes anim-1 {
0%, 8.3% { left: -100%; opacity: 0; }
8.3%,25% { left: 25%; opacity: 1; }
33.33%, 100% { left: 110%; opacity: 0; }
}
@keyframes anim-2 {
0%, 33.33% { left: -100%; opacity: 0; }
41.63%, 58.29% { left: 25%; opacity: 1; }
66.66%, 100% { left: 110%; opacity: 0; }
}
回叫URI就是这样。
// pages/login.vue
export default {
methods: {
this.$auth.loginWith('facebook')
}
}
https://localhost:3000/facebook/oauth_callback/?#access_token=***&data_access_expiration_time=1561715202&expires_in=4398&reauthorize_required_in=7776000&state=MC4xOTU3MDM2ODIxMzIzOTA5OA
this。$ auth。$ state不包含“ access_token”。如何获得“ access_token”? 我也不明白为什么URI在“获取参数”字段中包含“#”。因此,我无法从“ this。$ route.query”中获取access_token。
答案 0 :(得分:3)
答案 1 :(得分:1)
最后,我可以使用以下代码来做到这一点。
this.$auth.getToken('facebook')
感谢大家的观看。