Commit d4023c3b045a56107f630b59d80decd5944d16f9
1 parent
86ebd8b9
[Colab] Fix first sign_in session creation
Previously, if the user had to get created, for unknown reasons (see the FIXME), was siggned in but as soon it got redirected its session got messed in a way that it exists, so there are no new authentication attemps, but it is invalid so there are no `current_user`. If you clean your cookies and try again it would work. The workaround is to force the first broken session creation and right after destroy it. We are not proud of this. Signed off by: Diego Araújo <diegoamc90@gmail.com>
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
app/controllers/users/omniauth_callbacks_controller.rb
... | ... | @@ -4,6 +4,12 @@ module Users |
4 | 4 | auth = request.env["omniauth.auth"] |
5 | 5 | user = User.find_or_create_by(email: auth.info.email, name: auth.info.name, provider: auth.provider, uid: auth.uid) |
6 | 6 | |
7 | + # FIXME: apparently the first sign_in creates invalid session cookies, but the succeding ones are fine | |
8 | + # You may debug this by commenting out this workaroud, logging in, saving the session cookie, cleanin your cookies and loggin in again. | |
9 | + # Then you can try to search for any differences on the diff between the first and second cookie. Good luck! | |
10 | + sign_in(:user, user) | |
11 | + sign_out(user) | |
12 | + | |
7 | 13 | # Given colab works properly, since the user is always found or redirected, there is no chanche of an invalid user |
8 | 14 | sign_in(:user, user) |
9 | 15 | redirect_to root_path | ... | ... |