I am having trouble getting my redirect urls to work with signInWithOAuth & my vercel deployment "test branch" urls...
I have followed the suggestion here to have my code read process.env URLs:
export const getURL = () => { let url = process?.env?.NEXT_PUBLIC_SITE_URL ?? // Set this to your site URL in production env. process?.env?.NEXT_PUBLIC_VERCEL_URL ?? // Automatically set by Vercel. 'http://localhost:3000/'; // Make sure to include `https://` when not localhost. url = url.startsWith('http') ? url : `https://${url}`; // Make sure to include a trailing `/`. url = url.endsWith('/') ? url : `${url}/`; return url;};and I set NEXT_PUBLIC_SITE_URL to my production domain.
Here is the code that runs on sign in:
async function signInWithGoogle() { setIsLoading(true); try { const redirectTo = `${getURL()}auth/callback${next ? `?next=${encodeURIComponent(next)}` : '/'}`; const { error } = await supabase.auth.signInWithOAuth({ provider: 'google', options: { redirectTo: redirectTo } }); if (error) { throw error; } } catch (error) { console.error(error); } finally { setIsLoading(false); } }In my supabase dashboard, I added the RedirectURL to my list: http://**.vercel.app/**
I thought this would pickup anything from Vercel - such as: https://my-webapp-git-feature-sp-hash-my-projects.vercel.app/
- I can’t add a wildcard url to Google Console allowed URI
The end result is that after I sign in, it redirects to my production URL with the google code URL param instead of my Vercel deployment URL.
What am I missing?



