Back

How to make Usernames unique

  • 0
  • Self Hosted
  • Web
Hexi
7 Dec, 2023, 19:01

Hi I was wondering how to make usernames unique or atleast a way to not make it possible to change your username through the API but only the ones with a token so I can do the usernames myself.

TL;DR
The user is asking for help on how to make usernames unique and prevent them from being changed through the API. One solution is to create a separate collection for usernames and set permissions accordingly. The user can then create a function to generate and manage the usernames themselves.
Ernest
7 Dec, 2023, 19:03

What do you mean by username? Is it an attribute of a collection you've created?

Hexi
7 Dec, 2023, 19:03

No the Authentication side of appwrite

Hexi
7 Dec, 2023, 19:04
Ernest
7 Dec, 2023, 19:09

That's just the name field and not username. I don't think you can prevent the names from being changed in auth. You can, however, create a collection for usernames and set the appropriate permissions and create a function to create the usernames. So essentially, you'll not use the name attribute in auth at all.

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