5

Let's say I want to build an iOS app that uses a RESTful API as a backend.

I'd want to use Django Rest Framework for that. For three reasons:

  1. Python is awesome
  2. Django is awesome
  3. Django Rest Framework is popular and well documented

My app would need to authenticate users to control access to the different API endpoints. I would need to authenticate my clients through

  • my own OAuth2 provider
  • third parties OAuth2 providers (e.g. Facebook)

I found Django Oauth Toolkit to be the de facto standard to create your own OAuth2 provider. The integration with Django Rest Framework is well documented too and easy to achieve.

So far so good.

Now what If I want to add register/login through third parties? (Facebook, Twitter, etc).

I guess this is how the process would look like.

Auth through 3rd party providers

And without 3rd parties

Auth through own OAuth provider

I guess I would need to add social accounts tokens to user models (for re-authenticating and interacting with 3rd parties APIS). Django-allauth does that and I use it in one of my project, but sadly django-allauth doesn't seem to fit the current use case since the client is not provided by Django.

So is there a way (an app) to easily integrate social media login/registration with Django Rest Framework and Django OAuth Toolkit? I came across Python Social Auth but I'm not sure about how I would mix this with Django Oauth Toolkit.

Am I on the right path?

How would you implement such an authentication architecture/process with Django?

Thanks

Felix D.
  • 2,180
  • 1
  • 23
  • 37
  • I really need to add some pictures to that answer, but the idea is that instead of the client contacting the 3rd party for authentication, you do it for them. – Kevin Brown-Silva Apr 03 '15 at 11:55
  • But to do that they need to login first through my own OAuth2 provider am I right? But that would break the purpose of logging in seamlessly through Facebook no? I don't quite get it. I've came across your answer on the other post and red through it a couple of times but can't figure out the logic of it (not that this is your fault, it's clearly my lack of understanding some concepts). – Felix D. Apr 04 '15 at 17:43

0 Answers0