Skip to content
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

For api requests, the jwt token is not in the cookie #17

Merged
merged 1 commit into from
Apr 8, 2019

Conversation

brittneyexline
Copy link
Contributor

While testing openedx/edx-enterprise#444, it turns out that we can find the jwt token at request.auth when hitting the api directly, and not on the cookie.

@@ -50,7 +52,7 @@ def get_decoded_jwt_from_request(request):
Returns a decoded jwt dict if it finds it.
Returns a None if it does not.
"""
jwt_cookie = request.COOKIES.get(jwt_cookie_name(), None)
jwt_cookie = request.COOKIES.get(jwt_cookie_name(), None) or request.auth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a look here. I suspect for the sake of testing it might make sense just to mock request.auth (because tests dont use the same auth as in prod)

@brittneyexline brittneyexline force-pushed the bexline/add_request_auth branch from a3a6b75 to e68ddca Compare April 8, 2019 15:37
@brittneyexline brittneyexline force-pushed the bexline/add_request_auth branch from e68ddca to 69d8b44 Compare April 8, 2019 15:44
@christopappas christopappas self-requested a review April 8, 2019 15:46
@brittneyexline brittneyexline merged commit 9545bdb into master Apr 8, 2019
@brittneyexline brittneyexline deleted the bexline/add_request_auth branch April 8, 2019 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants