Auth0 Home Blog Docs

Return JSON as unauthorized error response

Hi,

When I try to access my API protected by Auth0 without a token, it returns me a 401 error with a HTML page. I’d like to know if it’s possible to configure a JSON response instead of HTML.

Thanks,
Davi.

Hey there Davi!

Let me research it for you if it’s doable and I’ll get back to you as soon as I have that info!

I got back to your message again and for me it seems like you may be doing something wrong with your API server.

Every Auth0 API always returns a JSON response not a HTML. Would you be able to share some code snippets with me via private message regarding the part of how you are using Auth0 to protect your API?

Thank you!

Hey there!

Have you had a chance to see my last message?