Supbase query works, but API call returns empty result #28995
-
I have a table in supbase with the following RLS: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
We need more context in order to help, looks like you are not setting the Authorization header correctly. Can you paste some code that actually sets up the API and calls it? Also, when you say "Supabase Query" you mean the supabase javascript (or some other language) library? And you want to use REST API directly? Or what are you actually meaning by the two Scenarios? |
Beta Was this translation helpful? Give feedback.
-
Thank you for looking into this. Here is the detail regarding your ask. |
Beta Was this translation helpful? Give feedback.
-
Hello! I am working on my project with flutterflow and something similar happens to me, please tell me if you have the same or a similar error, what happens to me is that the api test works perfectly but at the time of testing my App in the emulator or apk in only the first user who creates in the database works the response of the call api but in the other users or new users who I'm creating the API Call doesn't receive a response, I'm with FlutterFlow and SupaBase. Here's my post: |
Beta Was this translation helpful? Give feedback.
This is working now. The problem was that you need to pass JWT token through Flutterflow. In the header, make sure you spell the "Authorization" correctly (I had misspelled this) and create a variable something like the following: Authorization: Bearer [variableName]. Also, declare this variable at API level so that you can pass the JWT token from Supabase. This token can be retrieved from "Authenticated User" object. Once you pass this to API, the auth.uid() value will have correct userid and you can do RLS on that. Thank you all for helping!