0
votes

I'm new to Auth0 and having real trouble wrapping my head round it. My app is going to be built using React, packaged using Phonegap.

Am I able to use Auth0 with a completely custom UI for creating accounts, logging in etc.?

Ideally my signup flow would be...

  • User Signs up using my react form
  • Details are sent to my API and then passed to Auth0
  • Success message is received from Auth0 and the user is mirrored in my local DB

My ideal login flow would be...

  • User fills in email/password on my custom form.
  • Details sent either directly to Auth0 or via my API
  • Token is sent back and stored in localStorage

Then each request to my API...

  • React attaches token to every request in header (actually Axios interceptor does)
  • My API is able to verify that the token is valid and not expired
  • API performs request.

Not sure how to deal with social logins, claims etc. but that's for another day, basically I want to do everything through the API and not use their lock screen etc. Is this possible?

1

1 Answers

0
votes

Yes! That is definitely possible and to achieve this you would want to use 'Resource Owner Password' grant type.

Once you collect the credentials from user in your custom form, you can directly pass those to Auth0 by calling an endpoint - 'https://yourapplication.auth0.com/oauth/token' with all the necessary parameters. You can make a simple POST request to this endpoint from you client application. For ease of use, there is a javascript library provided by Auth0 for all of their endpoints- (https://auth0.com/docs/libraries/auth0js/v9). Auth0 will return a token which can be used to call your server side APIs by passing it to the request header.

So to conclude, you can do it through API without using their lock screen. Let me know if you need any further help. We can discuss on social logins and claims also.