Total newbie question, where do I find the options...
# gotrue
a
Total newbie question, where do I find the options I can pass into $supabase.auth.signIn so I can set the redirect URL? Current problem is I want to go back to the same site I came from and that varies depending on environment (eg localhost on dev and blah.com on cloudflare pages).
j
@agileben My understanding would be that you need to setup individual projects per environment. So your environment files or pipeline would inject the correct variables as needed on deploy or local run. Apart from that I'd also be configuring my application to look for a redirect_url query parameter and possibly a state query param to redirect the user to where they were before the flow initiated
a
Thanks @jaitaiwan - yeah I was considering creating a new environment per deployment, but Cloudflare pages creates a deployment per commit and the URL is unique (I think it's something like 1234.app.pages.dev).
As a newbie to auth it seems odd that the auth server needs to know about the call back URL - is that for security? I feel like the app should tell the server where to come back to somehow.
j
Yea that’s for security. So you reduce man in the middle attacks if I remember correctly.
@agileben Since we chatted this tweet just got released: https://twitter.com/kevcodez/status/1523649173790535680?s=20&t=BWfDkyHLNyGoSDjYLbZxtg
So it looks like you can update your code now
a
Amazing - well spotted @jaitaiwan I'll try that! I also found the docco for the signIn method here: https://supabase.com/docs/reference/javascript/auth-signin#sign-in-with-redirect
In case anyone looks here in future: the wildcard redirect URI's worked for me combined with using the signIn parameter redirectTo: window.location.origin + '/path'