5👍
(I have not used JWT but I don’t believe there is anything special about JWT compared to regular tokens, other than the extra security and more importantly, not having to keep a database table of tokens. So, my answer is for regular tokens, assuming/hoping you can adjust to JWT)
I am assuming you are trying to write stand-alone client, in which case, the problem is that django-allauth is not really intended for use with cleints/APIs, so a lot of the magic cannot be used through an API. See this some how old issue, which I believe is still valid: 3rd party REST/JSON APIs.
If you scroll to the end, you will see somebody recommending the use of django-rest-auth to handle the social login for the API, while keeping the main django-allauth handing the native django web site side of things.
I have not yet used them both together (I am currently not supporting social login on the API side, so haven’t had to deal with it).
This post shows an excellent example for developing an Angular Client using django-rest-framework. You will see how it creates its own APIs to registering and logging in. You should be able to replace that part with django-rest-auth, but the point is that django-allauth won’t really play a big role on anything that comes via the API (unfortunately).
Finally, you may also want to check my own implementation here. Look at the ‘authentication’ app, and look at the tests for how is used, which is my version of link 3
3👍
allauth
is basically for multi page Apps, for API login i recommend relying on
rest_auth
Rest Auth Docs
It has built in Login/Register etc built on top of all-auth
but for Single page apps.
then update settings, to
REST_USE_JWT = True
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'rest_framework.authentication.BasicAuthentication',
],
Now You should receive jwt token in response to login calls.
- Simple tutorial for Neo4J and using it with django + python
- "The connection was reset" in localhost:8000 using django and docker
- Django.core.exceptions.ImproperlyConfigured
- Issue with Django 2.0 : 'WSGIRequest' object has no attribute 'session'