-
Notifications
You must be signed in to change notification settings - Fork 6
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
#165273469 Add jwt authenticatication #8
Conversation
message = "User does not exist in the database." | ||
raise exceptions.AuthenticationFailed(message) | ||
if not user.is_active: | ||
message = "User is deactivated." |
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.
Return an appropriate message. eg.
message = "User is deactivated." | |
message = "User is not active." |
@@ -1,3 +1,4 @@ | |||
"""Imports relevant to our class.""" |
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 adding a comment but try and avoid unnecessary changes
authors/apps/authentication/urls.py
Outdated
@@ -1,3 +1,4 @@ | |||
"""Import relevant dependencies.""" |
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 adding a comment but try and avoid unnecessary changes
requirements.txt
Outdated
@@ -3,7 +3,6 @@ attrs==19.1.0 | |||
certifi==2019.3.9 | |||
chardet==3.0.4 | |||
coverage==4.5.3 | |||
coveralls==1.7.0 |
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.
We need this package please fix
ebf57a7
to
9d13ab6
Compare
9d13ab6
to
9f1d861
Compare
9f1d861
to
baa6300
Compare
- Add PyJWT to requirements.txt file - Enable jwt authentication in settings.py - Modify urls to cater for jwt authentication - Add a method in the models that generates a token - Add a method to check and verify for authorization header - Return a response with a token, message and username upon successful generation. [Starts #165273469]
baa6300
to
b46baed
Compare
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.
LGMT @engjames I am merging this. Good work.
What does this PR do?
-Add a jwt authentication
Description of Task to be completed?
For a person to get a token, he has to first create an account using http://127.0.0.1:8000/api/users/
The body should be in the form
{
"user": {
"username": "francis",
"email": "francis@gmail.com",
"password": "123456789"
}
}
Then login to get a token using http://127.0.0.1:8000/api/users/login/
The body should be in the form
{
"user":{
"email": "francis@gmail.com",
"password": "123456789"
}
}
What are the relevant pivotal tracker stories?
#165273469
@joelmugaya @Baalmart @mwinel @3Nakajugo @sanya-kenneth @KabohaJeanMark @archbishop12 @