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

Anonymous access to a shared database #258

Open
spiffytech opened this issue Jan 15, 2021 · 4 comments
Open

Anonymous access to a shared database #258

spiffytech opened this issue Jan 15, 2021 · 4 comments

Comments

@spiffytech
Copy link

spiffytech commented Jan 15, 2021

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?

@IvanCoronado
Copy link

I have the same question. Which one is the userbase way to allow users to have public data?

@j-berman
Copy link
Collaborator

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!

@IvanCoronado
Copy link

ty @j-berman for the workaround. I will give it a try.

@notthatnathan
Copy link

notthatnathan commented Feb 11, 2021

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?

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

4 participants