-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Don't clear oAuth2 session on restart #2701
Don't clear oAuth2 session on restart #2701
Conversation
Offer button to user where it can be cleared without restart
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.
Nice! I generally like this, I think it would be beneficial for folks who have different workflows.
I have a couple of observations from the implementation though, could you please check the behavior? 😄
…redentials' into feature/1550-dont-forget-oauth-credentials
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.
Progress! 😄
Given we want to make it opt-in for people to disable the clearing of the OAuth session on startup, here's what you'll need:
For the second item: looking at insomnia/packages/insomnia-app/app/main.development.js Lines 36 to 50 in 03d83a8
Before/during/after the const settings = await models.settings.getOrCreate();
if (settings.clearOAuthSessionOnStart) {
clearOAuthSession();
} Please reach out if you need any help! Thanks for working through this 🤗 |
Thanks for your advice. I tried to implement it as you described but it seems to me as if the task in main.development runs in a different thread than where I am trying to use oauth2/misc.js. When I set the currentSessionId in _launchApp it is still undefined when the OAuth2 window is opened. Also console.logs inside misc.js go into the terminal console when calling functions from launchApp and to the browser console when I later try to access the value which furthers my suspicion that they are running in different environments. Additionally window is not yet defined at that point, so localstorage is not usable at all. Also I fixed the styling per your suggestion, this is what it currently looks like: |
Nice sleuthing, that seems to make sense. When I was looking through that code, I noticed that It looks like you've put it in the right place 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.
Code looks good to me, thank you for working through this!
// the value of this variable needs to start with 'persist:' | ||
// otherwise sessions won't be persisted over application-restarts |
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.
Nice comment, some additional context here
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.
Very nice, thanks for your contribution! 👍
Offer button to user where it can be cleared without restart
Closes #1550