How can you use a cookies based Sorcery authenticated session in Grape under Rails?
I am interested in utilizing commands like session and current_user from a grape controller.
How can you use a cookies based Sorcery authenticated session in Grape under Rails?
I am interested in utilizing commands like session and current_user from a grape controller.
Copyright © 2021 Jogjafile Inc.
Add the following helpers to your root API mount point:
Including
Sorcery::Controllergave me all the sorcery methods (login, current_user, etc), but there were a few missing session methods that needed to be added via the helpers to make sure sorcery was happy. Note, Grape does not provide the same CookieJar as rails, so you won't be able to utilizecookies.signed. This was not an issue for me, but it may be for you. I worked around the sorcery functions that would call a signed cookie.