when using discord as provider the browser redirec...
# gotrue
g
when using discord as provider the browser redirects to => http://localhost:3000/empty/auth/v1/authorize?provider=discord. Here is the code snipet:
Copy code
const signInWithProvider = async (provider: any) => {
        const {user, session, error} = await supabase.auth.signIn({
            provider: provider
        })}
where the provider is
discord
g
hmmm... the redirect looks like
https://uaaaaaalvseqbsebbbbq.supabase.co/auth/v1/authorize?provider=discord&redirect_to=http....mm
You seem to have it set correctly.
g
the second one is in discord, that's what i found in the guide
g
Yes, mine is set the same
g
which supabase you have ?
g
?
g
package version
g
1.35.3 I've never tried it without redirect_to but that is supposed to be optional I thought.
g
can you share with me the value of redirectTo ?
g
Copy code
const {user, error} = await supabase.auth.signIn({
        //provider: 'github',
        provider: 'discord',
        //data:{key:'abc'},
    },
{
     redirectTo: 'http://mysite.us/somm'
}
)
And then have that set in SB auth settings.
g
in my case it would be localhost:3000 right ?
g
I've not tried it locally just on a test server. I don't use provider login in my real code. But I think so. Problem is the URL with provider=discord is supposed to come from the SB instance url.
The word empty in your url is also strange...
g
yeah i though i had some white space or something, but it seems there is an issue
g
let me turn off redirectTo...
URL is still correct without it.
Can you check the url for your client init?
It is likely not the callback in the discord url setting, but the initial call to supabase from your code that has the wrong url...
g
yes, that's the issue :/ i was initializing the client from process.env
and these variables are not available for the front-end of nextjs
g
Yeah, now that I look at it, that was obvious, but based on you saying the callback, I started down the wrong path. Glad it is resolved.
g
well it is not resolved yet
haha
this is related to nextjs, well i did export a const of supabase client from a folder called utils
and when i use that client in the front-end it doesnt not instantiate correctly wierd as if the .env variables are not exposed
g
I don’t use it, but I think you have to name then differently. Something with public as part of prefix.
g
yeah ive tried it, but i think i need to add them in nextj.config.js
g
All I could do is Google it. So if you don’t figure it out ask a new question.
g
Yeah yeah, thanks a lot
I appreciate your help