Get Auth0 User Metadata in NodeJS/Express backend (ReactJS frontend login)

Hello @robliou01 ,

Thanks for responding. I am noticing a couple things that I am doing wrong:

  1. the https://my-domain/api/v2/userinfo endpoint is invalid. The /userinfo endpoint is actually on the Authentication API as opposed to the Management API. the correct endpoint is https://my-domain/userinfo. But, even when I change the GET call to the correct endpoint - I still receive a 401 (unauthorized) error.

  2. When I changed the endpoint to https://my-domain/api/v2/USER_ID and inserted an actual USER_ID at the end of the endpoint, I successfully retrieve that user’s metadata. This is great, but I can’t figure out how to dynamically insert the USER_ID, based on the current user’s metadata. This would be very simple to do on the frontend, but I can’t seem to figure out how to do this on the backend.

// ---- My GET method is making a call to the Authentication API endpoint ----//
// ---- II think I need to use and ID TOKEN to retrieve this info ??? ---- //

var options = {
            method: "GET",
            url: "https://my-domain/userinfo",
            headers: {
              "content-type": "application/json",
              authorization: `Bearer ${accessToken}`,
            },
          };

          axios
            .request(options)
            .then(function (response) {
              console.log("RES DATA: ", response.data);
            })
            .catch(function (error) {
              console.error(error);
            });

With that being said, I understand how to request an ACCESS_TOKEN…but, how do I retrieve an ID_TOKEN from the frontend when a user logs in (other than using the JWT/JWKS-RSA approach)?

Using the JWT/JWKS-RSA approach causes a conflict with one of my 3rd-party API calls.