tylerjrichards/st-paywall

Remember login amongst refresh

Opened this issue · 7 comments

Would it be possible to implement remember login amongst refreshing? I have been experimenting with streamlit cookies packages but no luck with any of them. Great work btw!

this is a great point, I was chatting with @blackary about some ideas for this! it is trickier than we expected but hopefully we can figure out some solution for this

I have gotten this to work with a cookie manager instead of the session state.
Example managers:

I used the first one within this PR: #32

sorry for the late reply here, but I think there are some big problems with this approach. Mainly, if you stick the email in the cookie, then anyone can edit the cookie on their end to an email that they know is subscribed, and get access to your app. So what you actually have to do is create some sort of a hash, and store that has in a database in the app, which is much trickier than we/I had originally thought

Has this been updated to support sessions and persist on refresh yet?

Nope, no movement on this @jasonmcbride. PRs are welcome though if you'd like to take a hack at it!

I have gotten this to work with a cookie manager instead of the session state. Example managers:

I used the first one within this PR: #32

Would you be able to share a code, how did you manage to make it work? It would be very helpful! Thank you in advance. @pcejrowski

Hello, I just discovered this issue. Happy to work on it though I'm not an authentication expert.

Is there anything we can learn quickly from Streamlit-Authenticator?

Edit: I was just skimming and it looks like Streamlit-Authenticator is just relying on the packages mentioned above.

So what you actually have to do is create some sort of a hash, and store that has in a database in the app, which is much trickier than we/I had originally thought.

@tylerjrichards, would you mind expanding on this strategy a bit? I've got Supabase working with a streamlit app and I'd like to try it.