Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
How to get oauth2 client app from Django request

I'm using oauth2_provider + rest_framework. I have configured several client applications, and they successfully authenticate and receive access tokens.

I would like to have the client app in the request (Eg. request.client). Perhaps I should create some kind of middleware, which sets it, but I'm not sure what is the proper way to do it. Or maybe this functionality is already provided by the oauth2_provider/oauthlib, and I have overlooked it?

The client should be set when:

  • a valid access token is provided
  • valid app credentials are provided (like when requesting access token)

Python v3.5.3, Django v1.10.6

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

oauth2_provider AccessToken has a foreign key to the application issued that token

You can get the application form the access token like this: application = request.auth.application

about 4 years ago · Santiago Trujillo Report

0

AbstractApplication class has foreign key to settings.AUTH_USER_MODEL https://github.com/evonove/django-oauth-toolkit/blob/0.12.0/oauth2_provider/models.py#L62

So if you are using default Application class you could get the clients by request.user.oauth2_providers_applications

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!