I try to build Facebook login with auth-module the link below with Nuxt.js.
https://github.com/nuxt-community/auth-module
I can not get "access_token". the code is follows.
// pages/login.vue export default { methods: { this.$auth.loginWith('facebook') } }
the call back URI is like this.
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 don't include "access_token". How can I get "access_token"? I don't also understand why the URI include "#" in get parameter field. because of it, I can't get access_token from "this.$route.query".
Finally, I can do this with following code.
this.$auth.getToken('facebook')
Thanks for watching it guys.
This worked for me:
this.$auth.strategy.token.get()
Source: github.com/nuxt-community/auth-module
It may only be for the dev release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With