Questions tagged [django-oauth]

Django OAuth Toolkit can help you providing out of the box all the endpoints, data and logic needed to add OAuth2 capabilities to your Django projects

Django OAuth Toolkit can help you providing out of the box all the endpoints, data and logic needed to add OAuth2 capabilities to your Django projects. Django OAuth Toolkit makes extensive use of the excellent OAuthLib, so that everything is rfc-compliant.

Requirements:

  • Python 2.7, 3.4, 3.5, 3.6

  • Django 1.8, 1.9, 1.10, 1.11

Site: https://django-oauth-toolkit.readthedocs.io/en/latest/

Support: https://groups.google.com/forum/#!forum/django-oauth-toolkit

89 questions
2
votes
1 answer

How to login with mobile/otp using Django Oauth Toolkit

We are using Django OAuth Toolkit with DRF(Django Rest Framework). Now, we want to provide login with mobile number. To authenticate we'll use OTP(One Time Password). How can this be achieved? One solution is to directly create auth-token which…
Kumar Nitin
  • 1,715
  • 2
  • 13
  • 20
1
vote
2 answers

Django: Add data to JWT payload

I want to add data (such as the token expiration date or user info) to the payload of the JWT generated by this library. The current decoded payload of a JWT generated by this library is the following: { "token":…
1
vote
1 answer

Django OAuth - Include Authorization Header in Middleware?

I configured django-oauth-toolkit successfully. I want to authorize third party users after receiving an access token from an OAuth Provider. I am able to access restricted websites with it using it like this after saving it in the Django Admin:…
Juanvulcano
  • 1,204
  • 2
  • 18
  • 41
1
vote
1 answer

403 error with Django-Rest-Framework and Django-Oauth-Toolkit in client_credentials mode

I am trying to us the Django-Oauth-Toolkit authentication with the client_credentials mode, and I can: create successfully create my client_id and client_secret register my token But after, any api call using this token yields a 403 error with the…
Benjamin Breton
  • 910
  • 1
  • 8
  • 28
1
vote
0 answers

How do I specify DRF oauth required_scopes in function based api_view?

I'm trying to make my function based rest framework views which use the @api_view decorator with the Django OAuth Rest Framework Toolkit, where I'm using TokenHasScope as the permission_class. However, this needs a mandatory attribute called…
1
vote
0 answers

How to get new access_token from refresh_token using django_oauth_toolkit?

I am using django-oauth-toolkit version 1.1.2 to get access_token as seen below:- Reauest:- POST http://localhost:8597/login { "application_id": "cuOt3raxH9ClbCrbbgP68iU6ssfO2N78TplxwlMq", "username": "test@gmail.com", "password":…
1
vote
0 answers

Use OAuth2 with Spinnaker

So I have two services A and B, and A needs to login to B via Oauth2. B is using is using Django OAuth Toolkit as its Oauth2 provider. Service A is also a Django app (not really important). We are introducing Spinnaker into our stack so that we can…
Brodan
  • 147
  • 17
1
vote
0 answers

Django authentication JWT vs Oauth2

I am new to the Django authentication system. I've noticed most companies and developers prefer Oauth2 over JWT based authentication. I just read the Oauth2 documentation, but I don't understand what special features Oauth2 has, and why it is…
1
vote
0 answers

Django OAuth Toolkit how to log the user out

I have set up Django OAuth Toolkit in my project where the authorization server is separate from the application server (i.e accounts.example.com and app.example.com). App server redirects to accounts server using authorize flow; the user inputs…
Gasim
  • 6,241
  • 8
  • 53
  • 105
1
vote
1 answer

How to allow user to modify only his data in Django Rest Framework

i'm building simple API with Django 2.1.8 and provide security with Django OAuth Toolkit. I've reached the point where user can use api only after authorization but i want to limit his acctions only to his data. I've built authorization using oauth2…
1
vote
2 answers

"error": "invalid_client" django-oauth-toolkit

I am using django rest framework with django-oauth-toolkit. When i request access token on my localhost it gives me the access token as shown below ~/django_app$ curl -X POST -d "grant_type=password&username=&password="…
Aadil Shaikh
  • 311
  • 1
  • 3
  • 19
1
vote
0 answers

Use some other User Model instead of settings.AUTH_USER_MODEL in django oauth toolkit

I am using Django oauth toolkit to implement Oauth in my application. I am already having a user model, but i want to use some other user model which is not AUTH_USER_MODEL. What i can see now is that i can only extend all the models and use my…
Ezio
  • 603
  • 6
  • 13
1
vote
0 answers

Is it required to attach request.application in django-oauth-toolkit?

I have a separate resource and auth service and am trying to override the OAuth2Validator in django-oauth-toolkit to work with this setup. In the original impl, OAuth2Validator.validate_bearer_token sets the request.client to the OAuth2 application…
Nathan
  • 1,326
  • 3
  • 16
  • 30
1
vote
1 answer

Django foreign key constraint with Model that lives in different database

I'm trying to use the oauth2_provider library which provides a model for AccessToken, which foreign keys into a User model. My User model will actually live in a different database from the OAuth2 token models. I can use a router to direct which DB…
Nathan
  • 1,326
  • 3
  • 16
  • 30
1
vote
0 answers

Django Oauth2 Toolkit custom mixin

I have a particular situation where we're using Django's OAuth2 toolkit. I need to answer a request with a wrong token with a 401 (with a json) instead of a 403 forbidden. Following this commit I managed to come with…
L Maor
  • 11
  • 1