userbase
userbase copied to clipboard
Anonymous access to a shared database
I have a use case where users will be able to share data publicly, to anyone with the URL. Shared data will be unlisted, like unlisted YouTube videos, so anonymous logged-out users need to be able to see exclusively the thing shared with them.
Can I implement this with Userbase? I see items can generate a shareToken
for a database (and I guess move each shared item into a dedicated database), which sounds exactly like what I want, except a user has to be registered in Userbase to open a database using a shareToken
, so no anonymous access.
Does Userbase have a way to solve this?
I have the same question. Which one is the userbase way to allow users to have public data?
You are correct - the shareToken
is the exact way to go about sharing data in that way (or sharing data publicly), though a user must be signed in to open a database.
Allowing non-signed in users to open a database with a shareToken
is now on the roadmap (if curious, see more detailed discussion on this in #157).
For now, a workaround to this is to call signUp
in the background with a randomly generated username and password before calling openDatabase
with the shareToken
. Not a clean approach, but it's doable :)
@IvanCoronado - see #250 for how to use the shareToken
for your circumstance. Will have easier-to-follow tutorials on that available on the website soon!
ty @j-berman for the workaround. I will give it a try.
I had a similar use case to @spiffytech, so excited about the possibility of shareToken
not requiring login.
Another hole here that somebody might have a solution for: if you had a url like youtube.com/watch/:id, there appears to be no way in userbase to query based on a key (an index). So even if a database were shared publicly, how would one find the right database?