-
-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an authorize endpoint that uses JSON instead of a Django template… #1306
base: master
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #1306 +/- ##
=======================================
Coverage 97.37% 97.38%
=======================================
Files 32 32
Lines 2022 2028 +6
=======================================
+ Hits 1969 1975 +6
Misses 53 53
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…ango-oauth-toolkit into issue-1305-json-auth-endpoint
…ango-oauth-toolkit into issue-1305-json-auth-endpoint
elif require_approval == "auto": | ||
tokens = ( | ||
get_access_token_model() | ||
.objects.filter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could potentially avoid iteration by filtering by your desired scopes (assuming the scopes
var here is the required scopes of the view)
.objects.filter( | |
scopes_filter = { 'scopes__icontains': scope for scope in scopes } | |
.objects.filter( | |
user=request.user, | |
application=kwargs["application"], | |
expires__gt=timezone.now(), | |
**scopes_filter | |
).first() |
@jhnbyrn can you rebase this.. i'm open to using a mixin here if it enables you use case and doesn't break existing functionality. |
…/HTML form
Fixes #1305
Description of the Change
For single page applications it would be handy to be able to get the data for the authorization page as JSON and then render the authorization page on the client side, and similarly post the results as JSON rather than as a HTML form.
Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS