Auth0 Home Blog Docs

Auth0 using api


#1

I have some concern on this

1 ) I don’t want to use Lock implementation
2)My app is not in js. it is in react native
3)We need to make a native application on ReactNative. Authorization should not take place in the browser, but inside the mobile application, there should also be authorization by phone(Twilio)
4)I don’t want to use a browser

I don’t want to use universal login or auth0 Lock. I am able to trigger OTP using the API
like this

 fetch(`https://shimil.auth0.com/passwordless/start`, {
    method: "POST",
    headers: {
      "content-type": "application/json"
        },
    body: JSON.stringify({
      client_id: "XXXXXXXXXXXXXXXXXXXXXXXX",
      connection: "sms",
      phone_number: "+919633898851",
      send: "code"
})

})

but after getting OTP I tried to verify the OTP using

fetch(`https://shimil.auth0.com/auth0/ro`, {
      method: "POST",
      headers: {
        Accept: "application/json",
        "content-type": "application/json"
            },
      body: JSON.stringify({
        client_id: "XXXXXXXXXX",
        connection: "Username-Password-Authentication",
        phone_number: to,
        code: this.state.otpcode
      })
})

this Api getting response Not found. I need to verify the user using API


#2

Hey there @iamshimil

So there are actually a few ways to achieve user verification. Here they are:

1) You can either use one of our SDKs to make it happen (relatively the easier way):

2) Create the UI yourself and tie it with our Authentication API hitting the right endpoints:

Depends on what are your development capabilities and time resources. Here you can read more about Lock vs custom UI:

Hope it helps!