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 account does not have permission on schema "public" despite having valid JWT with "authenticated" role #1588

Closed
evelant opened this issue May 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@evelant
Copy link

evelant commented May 22, 2024

Bug report

  • [? ] I confirm this is a bug with Supabase, not with my own application.
  • [ X] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

I'm transitioning my app from firebase auth to supabase auth. When I use signInAnonymously() the client gets a valid JWT with the authenticated role but all calls to the database fail with permission denied for schema public

To Reproduce

  1. await supabase.auth.signInAnonymously()
  2. await supabase.from("table_name").insert(data)

Expected behavior

Anonymously authenticated users should have the same access to schemas as normally authenticated users

Screenshots

System information

  • OS: macos
  • Browser (if applies) N/A
  • Version of supabase-js: 2.43.2
  • Version of supabase-cli: 1.167.4
  • Version of Node.js: N/A

Additional context

Looking at the schema of my local db authenticated has usage permission on public so I'm not sure why I'm getting permission denied

@evelant evelant added the bug Something isn't working label May 22, 2024
@evelant
Copy link
Author

evelant commented May 22, 2024

Hmm OK it turns out that the session is disappearing from the client for some reason. I have a singleton client but somehow shortly after anonymous sign in the session disappears.

@evelant
Copy link
Author

evelant commented May 22, 2024

🤦 nevermind. I was clearing my mmkv instance (local storage) as part of my new user setup flow. Now that supabase auth is stored in local storage it cleared the session.

@evelant evelant closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant