score:0

Accepted answer

So I wasn't aware of the User Management API

To solve the issue of getting the user data to confirm authentication within my API server I decoded the JWT token server-side which contained the user ID, then I used the ID within a call to the management API to get the full user data.

The auth token for the call to the management API can be generated within the API dashboard on the Auth0 website

app.get('/authed', jwtCheck, async (req,res) =>{
    
    let token = req.headers.authorization.substring(7, req.headers.authorization.length)
    // GET THE DATA FOR THE LOGGED IN USER WHO MADE THE CALL
    var decoded = jwt_decode(token);
    console.log(decoded.sub)

    axios.get(`https://************.us.auth0.com/api/v2/users/${decoded.sub}`,{
        headers:{
            Authorization:`Bearer *`,
        }
    }).then((res) =>{
        console.log(res)
    }).catch(e =>{
        console.log(e)
    })

    res.send("secured resource")
})

Related Query

More Query from same tag