-
Notifications
You must be signed in to change notification settings - Fork 16
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
Basic auth #272
Basic auth #272
Conversation
In order to implement authentication I have made changes to the way routes and controllers behave. The main changes are:
I would like to know if this is a sensible way to split up actions. Once we can decide on the way we handle authentication we can look at using Devise, Passwordless or Clearence |
Request merge of pull request, I have overwritten current API version as we don't want an api version without any 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.
Thanks for reviewing @olleolleolle :-) |
Hi @olleolleolle thanks for going through and making your suggestions. I have made all the changes advised. Could the request be merged now? |
@@ -46,11 +45,15 @@ def wish_params | |||
end | |||
|
|||
def set_api_user |
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.
Why do we need the api_user_id
param? I would expect that api user, would be current_user
.
If we do need it, i think that logic should be moved to application_controller, so this controller doesn't need to be aware of this.
But I might be missing something
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.
Hi Dennis, if you are looking up a user other then the current user than you can pass in the parameter in the url, and that parameter will be used to set the api_user
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.
If you are looking at profile the user will always be set to current_user, but if you are looking at api_user, wishes or experiences the parameter can be supplied, if not supplied it shows information for current user
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.
@dennis is this ok or are changes required?
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.
For experiences/wishes, there is always a API User provided in the URL?
mentor-mentee-platform/server/config/routes.rb
Lines 15 to 18 in e2e790e
resources :api_users, only: [:index, :create, :show] do | |
resources :wishes, only: [:index, :show] | |
resources :experiences, only: [:index, :show] | |
end |
Or can you leave it blank in order to use current_user?
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.
Hi Dennis, you don't access experiences or wishes directly, it is always through a user.
profile/wishes/id_wish - returns wishes of the current user
api_users/id/wishes - returns wishes of user 'id'.
You can only create, change and delete wishes via profile.
The same goes for the experiences.
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.
I have nothing else to add :)
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 alot for reviewing Dennis
Branch basic_auth demonstrates basic implementation of jwt token. Would appreciate feedback about controller for users.