ra-data-postgrest
ra-data-postgrest copied to clipboard
No API key found in request
I would like to access to the Supabase tables but don't understand how to access with this plugin. Actually, I get this :
const httpClient = (url, options = {}) => {
options.user = {
authenticated: true,
token: process.env.REACT_APP_SUPABASE_ANON
};
return fetchUtils.fetchJson(url, options);
};
const dataProvider = postgrestRestProvider(process.env.REACT_APP_SUPABASE_URL, httpClient);
return (
<Admin dataProvider={dataProvider}>
<Resource name="posts" list={ListGuesser} />
<Resource name="authors" list={ListGuesser} />
</Admin>
)
Si when I try to access to the data, I have this error message : No API key found in request
This worked for me:
const httpClient = (url, options = {}) => {
options.user = {
authenticated: true,
token: `Bearer ${process.env.REACT_APP_SUPABASE_KEY}`
};
options.headers.set('apikey', process.env.REACT_APP_SUPABASE_KEY)
return fetchUtils.fetchJson(url, options);
};
@matthieup240 did the last answer resolve your issue? If so, please close this issue.
Problem resolved, thanks