https://supabase.com/ logo
#off-topic
Title
# off-topic
c

Cris Acosta

11/09/2021, 6:01 PM
I need change password from a user, but on the URL, has a /#access_token and I don´t get this value PHP, JS, nothing get this fragment
s

Scott P

11/09/2021, 6:12 PM
JS/Typescript example
Copy code
ts
export interface ISupabaseDeepLink {
  access_token: string;
  expires_in: string;
  refresh_token: string;
  token_type: string;
  type: string;
}

function hashToObject(entries) {
  const result = {};
  for (const [key, value] of entries) {
    result[key] = value;
  }
  return result;
}

const params = new URLSearchParams(window.location.hash.replace("#", ""));
const parsedParams: ISupabaseDeepLink = hashToObject(
  params
) as ISupabaseDeepLink;
If you
console.log(parsedParams)
, you'll see an object which includes the parameters from the URL
It feels a little bit hacky, but I've not been able to find an alternative solution so far
c

Cris Acosta

11/09/2021, 7:59 PM
Thanks man! But... i use SB on the Supabase web site
s

silentworks

11/10/2021, 10:28 AM
I don't get what you mean by this? the website would redirect you to your own website where you are using the
supabase-js
library, the above that @User has given you would be applicable at that point
I've just tested reset password and it seems the params are now query strings and no longer using a hash(fragment) in the URL
Ok this turns out to be false, somewhere in the process of redirecting to the URL with the query string, the Supabase library translates it to a hash (fragment) instead