Skip to content
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

Refresh signs me out #82

Open
ohadschn opened this issue Nov 26, 2017 · 10 comments
Open

Refresh signs me out #82

ohadschn opened this issue Nov 26, 2017 · 10 comments

Comments

@ohadschn
Copy link

If I hit the refresh button, or close and re-open the page, I get signed out.

I saw issue #44 which might be related, but if this was intentional I would humbly suggest you reconsider - practically all sites I can think of retain the OAuth cookie and keep you signed in as long as the token is valid...

This was referenced Nov 26, 2017
@chriszhangusc
Copy link
Collaborator

Yeah, I agree. Currently, the cookie expires when the session is done, maybe we can set an expiration time for the cookie and automatically login when current oauth token in the cookie is valid?

@ohadschn
Copy link
Author

ohadschn commented Nov 27, 2017

I don't think you need to set the expiration for the cookie yourself, you can just use whatever expiration policy you get with the SoundCloud token. In other words just try to use the token they gave you until you get 401, at which point re-authenticate.

@chriszhangusc
Copy link
Collaborator

@ohadschn Yes, I think it should work to use the token to check for 401 by the /me endpoint and if we do get a 401, we can remove the oauth token from the cookie and logout the current user.

@ohadschn
Copy link
Author

Logout and ideally open up the login window (to save the user from noticing he has been logged out and clicking login button again himself).

@chriszhangusc
Copy link
Collaborator

@rwieruch Any suggestions? I think this is a great improvement.

@rwieruch
Copy link
Owner

rwieruch commented Dec 2, 2017

Sounds great. Would you like to do it?

@chriszhangusc
Copy link
Collaborator

Yeah, I'm on it.

@rwieruch
Copy link
Owner

rwieruch commented Dec 3, 2017

@minipekka I added you as collaborator to the project. You introduced so many improvements by now, I think it would make sense to have someone else to help me out organizing the PRs :) Feel free to merge things on your own too!

@chriszhangusc
Copy link
Collaborator

I have a question about our session state. Currently, our session state holds an oauth_token and a dialog_session. I am not sure if it is necessary to store these two pieces of data because oauth_token is stored in Cookie and dialog_session is never used anywhere.
The only place that used session object is checking if there is a current user logged in. I think if we remove oauth_token and dialog_session from the state, we can simply check if the user object is null or not to see if it is authed or not.

@rwieruch
Copy link
Owner

rwieruch commented Dec 9, 2017

That's seems right without looking at the code. I don't remember how I implemented it back in the days. So if you have the feeling it could be simplified, please go for it! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants