[SOLVED] No api key found - despite having api key in params
I'm trying to create twitter authentication with supabase. I
console.log both of the .env params and they did show up. So i'm not sure why I'm getting the error {"message":"No API key found in request","hint":"No apikey request header or url param was found."} when I try to authenticate with Twitter.
.env
index.js
utils/supabaseClient.js
23 Replies
did you add your twitter api key to supabase in your project settings ? - https://supabase.com/docs/guides/auth/auth-twitter
Login with Twitter | Supabase
Add Twitter OAuth to your Supabase project
beautiful catch. thank you
@jdgamble555 any knowledge on how to capture the data with the verification? everytime i try to console log the data from the signin function, its gone?
are you using v2?
i believe so
it should await the login in v2 if you use await... double check
i do, but the problem is after it signs in and redirects, isnt the state data lost?
I believe it awaits now... try it out first please
i am
like this no?
There really is no useful data returned from the call is my understanding. It relies on the redirect (default site URL) from the 3rd party provider for the next step.
So basically getUser() immediately after?
This is the end of the signInWithOAuth code:
So goes to the provider URL, not sure it ever gets to the return...
yes. there is no useful data or error returned from a provider signup/login
if you run getUser right after, I wonder if it would work... I can't test it right now
I don't think it returns at all. The browser URL is changed to the auth provider url.
so then onAuthStateChange is the only way
Yes or getSession in the return page startup path.
the return page has to be root page though, correct?
I would think any page you redirect to could do getSession, guess it depends on the code setup.
but why that when i redirect to the same page and i getSession, its still undefined
like this doesn't ever print the session
I'm not familiar with react enough to tell what might be happening. Normally when the redirect happens, supabase-js knows there is a signin token from the redirect URL parameters and getSession will wait for things to get processed. If it is returning null then for some reason it is not getting the token when your code is run. You could put the onAuthChangeEvent handler in and see when/if the events are occurring.
This also presumes all this code is running on the browser.
but if the redirect goes back to the same page, shouldn't the getSession catch it? also why doesnt onAuthStateChange handle the change
Both methods should work as I understand it.
hmm yeah, currently not working for me
seems like it console logs undefined