Repository navigation
Keep the Onshape sign-in for 30 days instead of until the browser closes - #62
Merged
Merged
Conversation
The session cookie had no Max-Age, so browsers treated it as a session cookie and dropped it on every restart while the stored session still lived for 30 days; people had to connect Onshape again. The cookie now lasts 30 days, and every /api/session answer sets it again, restarting the 30 days without a KV write.
[Medium impact] The PR appears safe to merge. SummaryKeeps
Reviews (1) · Last reviewed commit: "Keep the Onshape sign-in for 30 days ins..." · Reviewed by Greptile |
This file contains hidden or 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
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.
Owner: "why do i have to connect onshape everytime its kinda annoying".
Cause.
controlkit_sessionwas set withoutMax-AgeorExpires, which makes it a browser session cookie. Browsers drop those when they close, but the stored session in KV lives 30 days. So every new browser session showed "Connect Onshape" again, although the sign-in itself was still valid.Fix.
Max-Age=2592000(30 days), the same lifetime as the stored session./api/sessionanswer sets the cookie again, so the 30 days restart on each panel load. That costs a response header, not a KV write; the KV session is still re-saved at most once a day.Not changed. If a browser blocks third-party cookies inside Onshape's iframe, sign-in still can't persist there. Onshape's own OAuth guide requires third-party cookies to be allowed for embedded apps.
Tests.
index.test.tschecks the redirect cookie'sMax-Ageand the cookie set again by/api/session. Typecheck and 324 unit tests pass.