简体   繁体   中英

Django REST Backend for mobile app with Facebook login

I have to implement a REST backend for mobile applications.

I will have to use Django REST Framework.

Among the features that I need to implement there will be the registration user and login.

Through the mobile application the user can create an account using ONLY the Facebook login.

Then, the application will take the information from Facebook using the token-facebook and it will send this data to my server.

I tried using python_social about Facebook authentication and user registration using the Facebook token.

At this point I have doubts:

think there could be two choices:

1:

The mobile application use the Facebook-login to retrieve user data and will send a request to my server to create a new user with the Facebook data user and passing the Facebook-token.

In this case, in the server side, it will not be integrated python_social and facebook-token is a simple profile field.

Doubts: how can you implement the next login (which password Is necessary to use?)

2:

The second possibility is to use python_social. In this way there are no problems for subsequent logins. The token Facebook will be used to retrieve the data (and validate the user) by calling: do_auth

But in this case, for each user, the server will have to make a request to Facebbok (which actually is possible to avoid: the mobile application has already recovered all the data)

What is the best case? What do you usually use for authentication backend rest with Facebook?

i didn't unerstand the first case, when you are using facebook login it does the authentication and we will register the user with the access token provided by facebook. When ever user log in we are not worried about the password, authentication is not done on our end. so when ever user tries to login it contacts facebook if everything goes good there, it will give you a token with that user can login.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM