-
Notifications
You must be signed in to change notification settings - Fork 59
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
Added a section in docs about decorators #67
Conversation
JWT and authorization can be a tough topic for beginners to break into. While the documentation clearly outlines the starting places, it has left out the portion for decorators and decorating the to-be-protected views.
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.
Thanks for the PR! 👍
If you could just apply a minor change or two and we're done. 🙂
docs/index.md
Outdated
@@ -97,6 +97,21 @@ Now in order to access protected api urls you must include the `Authorization: B | |||
$ curl -H "Authorization: Bearer <your_token>" http://localhost:8000/protected-url/ | |||
``` | |||
|
|||
In addition to adding the Authorization: Bearer in your requests, make sure that you have decorated your views properly. For this, import the JSONWebTokenAuthentication authenticaion class from rest_framework_jwt.authentication |
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.
JSONWebTokenAuthentication authenticaion
"authenticaion" is misspelled, and the JSONWebTokenAuthentication can be styled as JSONWebTokenAuthentication
make sure that you have decorated your views properly
I suggest you point out that this only applies to function based views. The class based views include this by overriding the authentication_classes
class attribute. Feel free to add an example for the class based views as well.
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.
Sure! I will modify the PR according to your suggestions!
Closes #66 |
Fixed spelling error in previous PR and added a section about class-based views in the doc.
I just made the changes. Could you review the changes? Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #67 +/- ##
=======================================
Coverage 98.12% 98.12%
=======================================
Files 19 19
Lines 481 481
Branches 45 45
=======================================
Hits 472 472
Misses 7 7
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
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.
Could you please add a changelog as well? I forgot to mention it the first time.
JWT and authorization can be a tough topic for beginners to break into. While the documentation clearly outlines the starting places, it has left out the portion for decorators and decorating the to-be-protected views.