I am currently working with react auth0 sdk and im struggling a bit. Im logging in with a user and sending the token to the backend that will create a ticket to reset password but it gives me error saying “Bad Token, Invalid JSON”.
I am using the audience of the default API of auth0 for the login and it still doesn’t work.
Why is this happening?
You can’t use the access token you acquired after login for management API. You need to authorize your app with the management API, and by doing that you will get a new access token used only for this API. You can find more info here: Management API Access Tokens
It’s recommended you do this on the backend using client_credentials flow. You should be able to do this on the frontend also, but the resulting token will be limited since front channel apps are not as secure: Get Management API Access Tokens for Single-Page Applications