-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix/use same cookie for all apps #277
Merged
Merged
Conversation
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
acezard
approved these changes
Jun 16, 2022
2bb2fc0
to
60824ba
Compare
Instead of trying to sync the used cookie with the displayed WebView we prefer to use the same cookie for all WebViews. This will be implemented in next commit This reverts commit 2b92e64
When calling `/apps/:slug/open`, cozy-stack generates a new cookie that should be used for the displayed cozy-app Each call returns a newly generated cookie that is associated with the returned token This may be problematic as all those cookies share the same domain and so we cannot discriminate them when displaying cozy-home or any other cozy-app and when we have multiple cookies available The easiest way to handle this is to force having the same cookie for all cozy-app and so to have all cozy-apps' tokens generated from this cookie By passing any existing cookie to `/apps/:slug/open`, we ensure the cozy-stack will use it to generate the token Related PR: cozy/cozy-stack#3429
When executed in Jest, react-native-cookies already return a mock so we don't need to handle it by ourselves
60824ba
to
fa43753
Compare
Ldoppea
added a commit
that referenced
this pull request
Sep 22, 2022
In some scenario (mainly in production) we observed that cookie was duplicated in the HTTP headers. Also both cookies were separated by a comma instead of a semicolon This form is not supported by cozy-stack and the result is that the cozy-stack consider the request is not cookie-authenticated So when calling `/apps/:slug/open`, a new generated cookie would be returned instead of the provided one as expected in #277 To fix this we want to specify `credentials:omit` into the fetch options, this would prevent react-native to inject a copy of the same cookie More info: facebook/react-native#23185 (comment)
1 task
Ldoppea
added a commit
that referenced
this pull request
Sep 30, 2022
In some scenario (mainly in production) we observed that cookie was duplicated in the HTTP headers. Also both cookies were separated by a comma instead of a semicolon This form is not supported by cozy-stack and the result is that the cozy-stack consider the request is not cookie-authenticated So when calling `/apps/:slug/open`, a new generated cookie would be returned instead of the provided one as expected in #277 To fix this we want to specify `credentials:omit` into the fetch options, this would prevent react-native to inject a copy of the same cookie More info: facebook/react-native#23185 (comment)
Ldoppea
added a commit
that referenced
this pull request
Sep 30, 2022
In some scenario (mainly in production) we observed that cookie was duplicated in the HTTP headers. Also both cookies were separated by a comma instead of a semicolon This form is not supported by cozy-stack and the result is that the cozy-stack consider the request is not cookie-authenticated So when calling `/apps/:slug/open`, a new generated cookie would be returned instead of the provided one as expected in #277 To fix this we want to specify `credentials:omit` into the fetch options, this would prevent react-native to inject a copy of the same cookie More info: facebook/react-native#23185 (comment)
Ldoppea
added a commit
that referenced
this pull request
Sep 30, 2022
In some scenario (mainly in production) we observed that cookie was duplicated in the HTTP headers. Also both cookies were separated by a comma instead of a semicolon This form is not supported by cozy-stack and the result is that the cozy-stack consider the request is not cookie-authenticated So when calling `/apps/:slug/open`, a new generated cookie would be returned instead of the provided one as expected in #277 To fix this we want to specify `credentials:omit` into the fetch options, this would prevent react-native to inject a copy of the same cookie More info: facebook/react-native#23185 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When calling
/apps/:slug/open
, cozy-stack generates a new cookie thatshould be used for the displayed cozy-app
Each call returns a newly generated cookie that is associated with the
returned token
This may be problematic as all those cookies share the same domain and
so we cannot discriminate them when displaying cozy-home or any other
cozy-app and when we have multiple cookies available
The easiest way to handle this is to force having the same cookie for
all cozy-app and so to have all cozy-apps' tokens generated from this
cookie
By passing any existing cookie to
/apps/:slug/open
, we ensure thecozy-stack will use it to generate the token
Related PR: cozy/cozy-stack#3429