I’m trying to understand the basic organizations and login flow between social logins on a mobile app and how that app requests resources from a backend flask api.
If the user logins into the app through Facebook, how does the backend api provide resources based on that login? Because it seems the backend doesn’t know the user has logged in with Facebook.
Does facebook need to send a token to the app that the backend api then validates with facebook?
2
Answers
I suggest you to first read about single sign-on mechanisms:
https://en.wikipedia.org/wiki/Single_sign-on
Then you can read about OAuth2 which is used by Facebook for SSO from here
https://oauth.net/2/
https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2
Simply you are correct, when user signs-in on Facebook, the backend will get token from Facebook that is used for authentication/ authorization of that user.
This is happening when a Facebook/Google log in is clicked on an XYZ website.
More elaborated here : https://www.scienceabc.com/innovation/oauth-how-does-login-with-facebook-google-work.html