How to integrate authentication in MERN app using Auth0?

Please let me know what I am missing or even I am using the right approach?

The flow I am trying to implement is given

  1. User login/signup from FE(ReactJS)
  2. FE get the access token
  3. On Auth0, use action to create the same user in my database on signup.
  4. And after login, FE will send make call to my expresJS server
  5. ExpresJS validates the access token.

What I did to implement this flow.

  1. Create SPA app on Auth0 dashboard
  2. Created Machine-to-Machine application on Auth0 dashboard
  3. Use respective SDKs on FE and BE

What is happening

  1. User is able to login/signup on FE
  2. Not able to verify access token on BE

Hi @sami.ullah1122

Welcome to the Auth0 Community.

I understand the key issue here is you are not able to verify the access token on the backend. In the first instance I would review our docs in this area i.e. our Express backend guide as it provides a walk through of how you would validate the access token https://auth0.com/docs/quickstart/backend/nodejs/01-authorization#validate-access-tokens

You may have already seen this given you mentioned the backend uses the respective SDK.If you had some issues in validating the access token can you elaborate on what those issues were?

Warm regards.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.