Edit:
I could of keep using request but when I am hosting it on vercel as a serverless function it does not work and gives an unauthorized error. So I was thing maybe this can be fixed with Axios.
Another Edit:
I switched to node-auth0 library and it works like request perfectly fine on localhost but on vercel it gives error
Thanks for the reply @ty.frith.
I have doublechecked the client_id and client_secret and It is the same as my local environment variables. I don’t know what could be causing this problem.
Edit:
I think it has to be problem with environment variable on vercel when I hard coded value and deployed it on vercel it worked