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

Enable users Endpoints #10

Merged
merged 2 commits into from
Aug 27, 2023
Merged

Conversation

juanarias93
Copy link
Collaborator

What & Why

Enable and test user endpoints that will be consume from the Frontend.
In particular, the ones related to Registration and SignIn/Out.

These are the default routes for Users from devise:

Screenshot 2023-08-26 at 3 00 37 PM

Disclaimers

Application was returning a 500 error after successfully creating a user. This is because devise tries to authenticate the resource that got created, and when trying to call authenticate_user! it failed with the following error:

ActionDispatch::Request::Session::DisabledSessionError (Your application has sessions disabled. To write to the session you must first configure a session store)

This is apparently a known issue reported here.
I used the temporary solution posted here.
There's also an open PR on devise for fixing it.
If the PR gets merged eventually, this fix/patch won't be necessary anymore.

How

  • Permit required params when using Devise controllers.
  • Fix DisabledSessionError from ActionDispatch (see Disclaimers section).
  • Test manually with Postman.

Links

Postman Screenshots

Successful POST request for creating a new user

Screenshot 2023-08-26 at 4 59 46 PM

Successful sign_in of the user

Screenshot 2023-08-26 at 5 18 05 PM

Unsuccessful sign_in of the user

Screenshot 2023-08-26 at 5 18 18 PM

  * In particular: name and birth_date
  * If eventually birth_date becomes not required, then it can be
    removed from here.
`authenticate_user!`

  * This is a known issue reported here: heartcombo/devise#5443
  * There's also an open PR to devise for fixing it: heartcombo/devise#5474
  * If the PR gets merged eventually, this fix/patch won't be necessary
    anymore.
@juanarias93 juanarias93 merged commit 714843f into main Aug 27, 2023
@juanarias93 juanarias93 deleted the juan_arias--enable_users_endpoints branch August 27, 2023 18:30
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