pythoniosdjangodjango-socialauth

Log in with Django-social-auth and tastypie on iOS


I'm building out an API using tastypie for an iOS app.

I can handle normal authentication / authorization just fine but I'm a bit confused when it comes to using django-social-auth to register / login / link THROUGH Tastypie.

If I'd, for example like to authenticate or register users on an iOS app using django-social-auth and tastypie, how would I go about that? Any suggestions? Am I looking at this the wrong way?


Solution

  • You cannot use django-social-auth directly.

    To do Facebook login, you need to use the Facebook SDK for iOS (https://developers.facebook.com/docs/reference/iossdk/).

    It will return you the access token which you would send to your API created using TastyPie.

    When you have the access token, you can register a new user based on that. Using the Facebook Graph API, you can get the user's name and other info. Make sure to save the access token so you can identify a returning user.

    After you register or login a user, return a "token" that is specific to that user. Your site generates the token. You'll use that token to communicate with your site.