I'm a noob coder,please tell me how to login and register just only use phonenumber in strapi V4?

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

my users more than 90% don’t use email in china,they usually used Wechat register&login,but i don’t know how to change strapi v4 default identifier from email to phonenumber,please tell me how to change,thanks​:grinning::grinning::grinning:。Excuse me, my English is poor.

im try to setting plugin,but it not work

To switch the main way of identifying users from email to phone number in Strapi v4, follow these steps: First, open the file named “config/auth.json.” Inside this file, locate the property named “identifier” and change its value from “email” to “phone_number.” Make sure to save the file afterward. Once this is done, you’ll need to make a new user by sending a special type of request (called a POST request) to a place in Strapi called “auth/local/register.” This request should include certain information about the user, such as their email address (if available), phone number, and password. Here’s an example of what this request might look like:

POST /api/auth/local/register
Content-Type: application/json

“email”: “johndoe@example.com”,
“phone_number”: “+86 1234567890”,
“password”: “password123”

If this request works correctly, Strapi will create a new user and send back some information about them. If you’re using an extra tool (called a plugin) to let users log in with their phone numbers, you might need to set up the plugin to use phone numbers instead of emails for identification. The exact steps for doing this can be different depending on which plugin you’re using. Feel free to ask if you need more help!

1 Like

:stuck_out_tongue_closed_eyes:thanks for your reply bro。i want to create account just for phonenumber、username and password,cuz users don’t even have an email :joy:,but why my project directory absent config/auth.json file?it’s need create by myself? :dizzy_face: