Auth0 Home Blog Docs

How to show less data if access token is not valid?

access-token
middleware
permission

#1

Hello I have create a Node API based on Auth0 tutorial ( I can protect a url but i would like to be visible just to show less data if access.token doesnt exist)

something like
app.get(’/api/privateurl’, checkJwt, function(req, res) {

if (access_token===valid) {
res.json({
message: “Hello from a private endpoint! You are authenticated! YOu see more data…”
});
} else {
res.json({
message: “Hello from a private endpoint! You are not authenticated! YOu see fewer data…”
});
}
});