Attempt to fix login redirect behaviors #211
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Must be tested behind proxy to know if it works. I identified two problems here:
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 withurl_for
for the proxy to be takenin to account.
login_user()
call. At this point, Google has authorized the user, so when they hit/login
again, they'll hit thelogin_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
馃摎 Documentation preview 馃摎: https://usaon-benefit-tool--211.org.readthedocs.build/en/211/