# Extract magic token from url

**URL:** https://community.weweb.io/t/extract-magic-token-from-url/5636
**Category:** How do I?
**Tags:** authentication
**Created:** [November 30, 2023, 7:59am UTC](https://community.weweb.io/t/extract-magic-token-from-url/5636 "2023-11-30T07:59:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![akshatgarg](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@akshatgarg](https://community.weweb.io/u/akshatgarg)
#### Post date: [November 30, 2023, 7:59am UTC](https://community.weweb.io/t/extract-magic-token-from-url/5636/1 "2023-11-30T07:59:45Z")

</div>

I am using Xano + Sendgrid for magic link for reset password flow. However, the one thing I am stuck at is extracting the token from url.

I am trying the same by setting url parameter from weweb and then using the value of same parameter.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/8/8727580d71d8af5d20dc889d2312b1bb54aa739d.png)

But when I load the page with the token, it gives 404.

What I am able to understand is that token has characters which are not acceptable as parameters in weweb. This is resulting in 404 as the same page is loading if I put any random acceptable characters at the end of url.

I know there are few topics related to the same (one of the most relevant is below, but extracting token from parameter is not resolved in the same)

> [@Get Parameter from URL](https://community.weweb.io/t/get-parameter-from-url/329):
>
> I am trying to set up Magic Link through Xano and SendGrid. I’ve got everything working but I have to get one final piece of the puzzle set up. I need to be able to extract the magic token from the user’s URL, and then can exchange that for an auth token with Xano. Here’s an example of what the URL looks like: [https://www.goaloe.app/magic-link-auth?token=EBhgaAGERk123akadASFDKJWL.KAJAFS834;LJ43T9KaADFAS;A;-0A;KLSDFJC9ADEFNDSA;a0d9.aksfdASDJkA;SLDJKN32ASD.DZTCo1Tm2W3bBwbxOOoLWrtID11qj\_fSUD0LcM-…](https://www.goaloe.app/magic-link-auth?token=EBhgaAGERk123akadASFDKJWL.KAJAFS834;LJ43T9KaADFAS;A;-0A;KLSDFJC9ADEFNDSA;a0d9.aksfdASDJkA;SLDJKN32ASD.DZTCo1Tm2W3bBwbxOOoLWrtID11qj_fSUD0LcM-BlikKJ;A3NADFAAN44kDFNDSJNQKNKNnadsJEW443Kndasfl;khG47xc4._kafdsKASDFNkNDFKJkan;9834t7JAFDkd3KDk3KANnRnALPHs)

Can someone please help me here?

---

<div class="post-metadata">

### Author: ![AgentD](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/agentd/32/6331_2.png) [@AgentD](https://community.weweb.io/u/AgentD)
#### Post date: [November 30, 2023, 11:42am UTC](https://community.weweb.io/t/extract-magic-token-from-url/5636/2 "2023-11-30T11:42:10Z")

</div>

Hi @akshatgarg you are almost there.

You have a few things mixed up. Let me help you understand

The format for query parameters in url is as follow

{the base url}/{the page route}?{the name of the query param}={value of the param}

Now in your case the reason you are getting a 404 is because the page you want them to go looks like it is called

```auto
update_password 

```

but the link you have generated is taking them to a page called

```auto
magic-link-auth

```

Which doesn’t exist in your project it will seem

So your link should be like this

```auto
https://www.goaloe.app/update_password?token=EBhgaAGERk123akadASFDKJWL.KAJAFS834;LJ43T9KaADFAS;A;-0A;KLSDFJC9ADEFNDSA;a0d9.aksfdASDJkA;SLDJKN32ASD.DZTCo1Tm2W3bBwbxOOoLWrtID11qj_fSUD0LcM-BlikKJ;A3NADFAAN44kDFNDSJNQKNKNnadsJEW443Kndasfl;khG47xc4._kafdsKASDFNkNDFKJkan;9834t7JAFDkd3KDk3KANnRnALPHs

```

Now on the update password page you should create a query parameter variable called ‘token’  
That variable is the one that will store the token value

---

<div class="post-metadata">

### Author: ![akshatgarg](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@akshatgarg](https://community.weweb.io/u/akshatgarg)
#### Post date: [November 30, 2023, 2:38pm UTC](https://community.weweb.io/t/extract-magic-token-from-url/5636/3 "2023-11-30T14:38:42Z")

</div>

Thanks a lot, its working now. Glad you explained it in quite a detail.
