I'm a new developer and this is my first time posting to Stack Overflow
I'm using supabase for my db and authentication on my React app. I'm trying to integrate their 'Reset Password' feature (which emails you a link that includes the token in it), but I'm having a hard time recovering the token from the URL when I click on it and am rerouted to my app.
The Supabase documantation says this: When the user clicks the reset link in the email they will be forwarded to: <SITE_URL>#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery Your app must detect type=recovery in the fragment and display a password reset form to the user.
When I click the link, it generates a url like this: https://mysupabaseurl/auth/v1/verify?token=zpJG16Xr3kjCUZKUI_WOwQ&type=recovery&redirect_to=http://mysiteurl/
Here is what I have in my code to try to grab that token:
const params = new URLSearchParams(window.location.hash);
const accessToken = params.get("access_token");
console.log(accessToken);
I've also tried:
const params = new URLSearchParams(window.location.search);
const accessToken = params.get("access_token");
console.log(accessToken);