I am using auth0 for authentication and I am wanting to retrieve the user_id of the user that is currently signed in in order to retrieve that users data from my database.
Right now I am using the request URL:
https:// my tenant .us.auth0.com /api/v2/users?fields=user_id
in my code:
var axios = require(“axios”).default;
var options = {
method: ‘GET’,
url: ‘https:// my tenant .us.auth0.com /api/v2/users?fields=user_id’,
headers: {authorization: 'Bearer MY_MGMT_API_ACCESS_TOKEN '}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
}
and in the console in my website it gives me a list of all user_ids in my auth0 account. I just want the one user_id from the user that is currently logged in. How do I do this?