Back

[SOLVED] how can i set an username while creating the account with magic URL?

  • 0
  • Accounts
  • Web
manazo
18 Aug, 2023, 10:10

I'm using the magic URL feature to get my users signed in/up. But for new users, I want to set a default name, which they can change later. Like if we use account.create(), we can pass the name there. Can we do the same while updating the magic URL session?

For context, I'm handling the updateMagicURLSession manually as I'm doing it on the server-side

TL;DR
The user wants to know if it's possible to set a username while creating an account using a magic URL. It is not possible to set a username using the magic URL endpoint, so the user will need to call the `updateName` function separately after the account has been created. There is no way to do it in one call like the `account.create()` function. The user is handling the `updateMagicURLSession` manually on the server-side.
Drake
18 Aug, 2023, 19:02

For context, I'm handling the updateMagicURLSession manually as I'm doing it on the server-side

How exactly?

you might need to call user.updateName() after the account has been created

manazo
19 Aug, 2023, 10:13

How exactly? I'm hitting the endpoint with all the required headers using JS fetch as you suggested here (https://discord.com/channels/564160730845151244/1138952904166871206)

manazo
19 Aug, 2023, 10:13

you might need to call user.updateName() after the account has been created it'll make two calls in the server. is there any way we can do it in one call like the account.create()?

safwan
19 Aug, 2023, 10:43

The Magic URL endpoints do not accept a name parameter at all. So for now, using the updateName suggested by Steven is your best bet

Drake
19 Aug, 2023, 15:07

No

Drake
19 Aug, 2023, 15:07

What exactly is your code and what's wrong?

manazo
19 Aug, 2023, 17:21

my code mostly looks like this https://github.com/Meldiron/appwrite-ssr-next-js/blob/32cbcd586be3d63423d8bfc7a3a7e958dad00eba/src/app/api/login/route.ts#L39

and nothing is actually wrong with the magic URL endpoint. I was just thinking if there's any way to set the user name with the same endpoint, like account.create(). but seems the only way to go is by calling the updateName function

Drake
19 Aug, 2023, 17:23

Oh okay. The question about updating the name has been answered then

manazo
19 Aug, 2023, 17:24

i got another queue about storage.updateFile(). should i continue it here or create another post regarding that?

Drake
19 Aug, 2023, 17:25

New post

manazo
19 Aug, 2023, 17:26

[SOLVED] how can i set an username while creating the account with magic URL?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more