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

Bug fix -- log in redirects to unexpected location #178

Closed
hazelshapiro opened this issue Nov 15, 2023 · 0 comments · Fixed by #211
Closed

Bug fix -- log in redirects to unexpected location #178

hazelshapiro opened this issue Nov 15, 2023 · 0 comments · Fixed by #211
Labels
bug Something isn't working
Milestone

Comments

@hazelshapiro
Copy link
Collaborator

Log in often sends users to this page: https://usaon.org/evaluation-and-planning/benefit-tool rather than into the benefit tool application. Priority issue to fix.

@hazelshapiro hazelshapiro added this to the Bug fixes milestone Nov 15, 2023
@mfisher87 mfisher87 added the bug Something isn't working label Dec 18, 2023
@mfisher87 mfisher87 changed the title Bug fix -- log in redirect Bug fix -- log in redirects to unexpected location Dec 18, 2023
mfisher87 added a commit that referenced this issue Dec 18, 2023
Must be tested behind proxy to know if it works. I identified two
problems here:

1) `flask-dance` was redirecting to `/` by default, but the app in
   production is hosted behind a proxy at `/apps/benefit-tool`. We need
   to generate the correct URL with `url_for` for the proxy to be taken
   in to account.
2) The old login route needs to be hit twice to actually log in a user.
   The first time through, it sends the user to Google, and at the end
   of that, the user winds back up in the app without having hit the
   `login_user()` call. At this point, Google has authorized the user,
   so when they hit `/login` again, they'll hit the `login_user()` call.

Both of these problems are addressed by hooking the `oauth_authorized`
signal (https://flask-dance.readthedocs.io/en/latest/signals.html) and
moving the login & user-insertion behavior there.

Resolves #178
mfisher87 added a commit that referenced this issue Dec 18, 2023
Must be tested behind proxy to know if it works. I identified two
problems here:

1) `flask-dance` was redirecting to `/` by default, but the app in
   production is hosted behind a proxy at `/apps/benefit-tool`. We need
   to generate the correct URL with `url_for` for the proxy to be taken
   in to account.
2) The old login route needs to be hit twice to actually log in a user.
   The first time through, it sends the user to Google, and at the end
   of that, the user winds back up in the app without having hit the
   `login_user()` call. At this point, Google has authorized the user,
   so when they hit `/login` again, they'll hit the `login_user()` call.

Both of these problems are addressed by hooking the `oauth_authorized`
signal (https://flask-dance.readthedocs.io/en/latest/signals.html) and
moving the login & user-insertion behavior there.

Resolves #178
Resolves #58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants