Currently I have two separate apps
- Frontend (Nuxt)
- Backend (Golang)
On the backend I'm using a third party library called Goth and I'm using Facebook as the provider. Everything works fine on the backend but I'm confused on how to do on the frontend which is on the Nuxt side
So technically on the backend there will be two urls
/auth/facebook
/auth/facebook/callback
Once everything is correct then I will get the object from facebook on the backend side which is the API written in Golang
data: {
RawData: {
email: "john@gmail.com",
first_name: "John",
id: "123123",
last_name: "Grave",
name: "John Grave",
picture: {
data: {
height: 50,
is_silhouette: true,
url: "https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=13123123&height=50&width=50&ext=1553079619&hash=AeTX5RW5K_avWLbI",
width: 50
}
}
},
Provider: "facebook",
Email: "john@gmail.com",
Name: "John Grave",
FirstName: "John",
LastName: "Grave",
NickName: "John Grave",
Description: "",
UserID: "123123",
AvatarURL: "https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=2312802522337124&height=50&width=50&ext=1553079619&hash=AeTX5RW5K_avWLbI",
Location: "",
AccessToken: "EAAIuR3NSCPwBAEcp2jskHuUCzdWLB97Aq99nCV5HuieVVz8xGfJ6exAZDZD",
AccessTokenSecret: "",
RefreshToken: "",
ExpiresAt: "2019-04-19T15:52:59.895655+08:00"
},
status: 200
}
Assume that everything is working fine on the backend.
The only thing that I could think of is calling it on the method (Nuxt side)
export default {
methods: {
facebookLogin() {
window.location.href = `http://localhost:8080/auth/facebook`
}
}
}
This will just redirect to the
http://localhost:8080/auth/facebook/callback?code=AQAaq9GYcGAnQ9wUCDAd5BFRHxMRjqGFR0J6zjGtYpD-
What are the correct steps should I do to communicate with the backend OAuth API?
Thanks!