-
Notifications
You must be signed in to change notification settings - Fork 171
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
RCORE-2253 Redirected user authenticated app requests cause user to be logged out and location is not updated #8011
Open
michael-wb
wants to merge
28
commits into
master
Choose a base branch
from
mwb/add-core-redirect-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
aa34635
Removed redirect tests
fd52bb1
Removed one more location redirect test case
3a9c663
Removed 301/308 redirection support from App
519a71e
Updated changelog
8a753e5
Updates from review
d5c2800
Merge branch 'master' of github.com:realm/realm-core into mwb/remove-…
3cc2261
Merge branch 'mwb/remove-308-tests' of github.com:realm/realm-core in…
aba04c7
Updated redirect server to support App request redirects and created …
e0a971d
Added test to verify http redirects using CURL to handle the redirect…
420d56a
Added test sections and print error on create_user_and_login() failure
a06e319
Updated changelog; some cleanup; moving redir_server tool to separate PR
69c232c
Addressed some build and test failures
3c0cd07
More minor updates to fix build and test failures
4e8484e
Merge branch 'master' of github.com:realm/realm-core into mwb/remove-…
5728e1f
Updated changelog after release
3c6229a
Fixed misspelling and updated comment a bit
dd1d4bc
Merge branch 'mwb/remove-308-support' of github.com:realm/realm-core …
0d46d77
Merge branch 'master' of github.com:realm/realm-core into mwb/add-cor…
ebcfe93
Updates from review - removed some changes needed by redirect server …
9a9371d
rerun validation
307fdb7
Fixed TSAN error
2b2c59c
Merge branch 'master' of github.com:realm/realm-core into mwb/add-cor…
1d1edf9
Update location after auth failure; updated test comments
ce1aeec
I thought I removed this line...
a4e967a
Reverted line now that login is not always requesting location
761f18b
Updated changelog
49961ab
a little more cleanup
ee81ab4
Fixed refresh access token test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think getting logged out is the existing behavior that's always been there, do we really want to change that now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do get logged out, but you will never be able to logged in again due to the authorization header being stripped from the
/profile
request, which will log you out while you are trying to log in.By updating the location when you attempt to log in, the client app will have the latest server location info and the login attempt should be successful, instead of failing when trying to query the user's profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So has redirection after a region migration always been totally broken? Like you cannot recover? Because I think all the SDKs HTTP implementations have been stripping the authorization header out when following a redirect this whole time...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's definitely an edge case and I doubt any customers have hit this specific use case:
they have to do a deployment change while the app is already running; and the user has to have already performed some operation that updated the location prior to the deployment change, such as logging in.
After the deployment change (and the requests start getting redirected), any app services request like updating the access token will log the user out and they won't be able to successfully log in again.
Fortunately, restarting the app will also resolve the issue, since it will require the location to be updated before sending any app services requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about this offline - instead of making every call to
log_in_with_credentials()
pre-emptively request a location update, we're going to request a location update if the call to get the user's profile fails with a 401 unauthorized error. That way this error handling gets a bit slower in this edge case, but the behavior of all otherlog_in_with_credentials()
should stay the same.