-
-
Notifications
You must be signed in to change notification settings - Fork 791
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 signals when a token is generated #489
Conversation
I wonder, however, if simply binding to |
oauth2_provider/views/base.py
Outdated
if status == 200: | ||
access_token = json.loads(body).get('access_token') | ||
if access_token is not None: | ||
token = AccessToken.objects.get(token=access_token) |
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.
AccessToken
is a swappable model, you need to instantiate is using get_access_token_model
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.
Applied, thanks
This looks great, could you add documentation? |
@jleclanche Here you go ;) |
I did a small change to the code - instead of passing the application down to the signal, I'm now passing the token, as it contains more useful information |
So, anything else is needed in this PR? Can it be safely merged? |
Landed in 18bbdc1 - thank you for your contribution! |
When this change will be deployed to pip? |
I don't think any time soon seeing as it's the only change since 1.0. Tip: you can do
|
Yes, I was installing it from the latest master directly. Thanks for response! |
This PR adds a very simple signal that fires up each time a token has been generated for an application.
Now I don't know if this is the right place to have such signal, but it looks like the right one (oauthlib isn't django-specific, so it didn't seem a good place to put it there in
create_token_response
).Please let me know if it's a feature that you'd like to see in the upstream - if so, I will write additional unit tests.