Laravel Socialite is using OAuth 2.0. It is ugly for facebook. I don't like idea of sending users to facebook page and getting them back, when we can use pop-up.
So, my plan was using standard Facebook popup from javascript api
.
fist - using Basic Setup to get javascript library
second - getting login dialog to work.
It works and I get userID
and accessToken
.
Now problems starts
accessToken - is ageing and I cannot save it in database for later use as a password.
So there is an alternative to saving accessToken - I can use another facebook api know as graph api
to get user by token, if my server made an api request directly to facebook like so
https://graph.facebook.com/me?access_token=...
I'd get a user_id like so
{ "name": "Bob Marley", "id": "111111" }
and I can be sure about this identity, because I just checked the token with facebook server directly. It sounds like ideal world.
However, there are 2 things that makes me nervous:
1) Have I really combined 2 different api, or is it a standard approach?
2) How did I manage to have my user authenticated without using facebook app secret
? Where is a catch?