Phone authentication

how to set up user with phone authentication only (without the need for email)?
the process will mainly use phone number as the login username … reset-password will use OTP sent to phone… etc
so mainly is to drop the need of email for the user

Take a look at how the Authentication currently works:

After understanding how it works you should be able to create your custom routes/controllers to manage phone login.

Create a new route for logging in by phone and use the desired users-permissions services there.

For example, to issue a jwt token for the user, you can use the users-permissions’s jwt.issue service:

let jwt = await strapi.plugins['users-permissions'].services.jwt.issue({
  id: user_id
})

Did you try this?

Hello, I have setup the same feature on this github repo - https://github.com/mayank-budhiraja/strapi-with-otp-integration

A user is authenticated only through the OTP verification and all auth requests are made using the JWT token.

1 Like