I am following this code in the docs to get an access token from the management API: Get Management API Access Tokens for Production
However, I read that this shouldn’t be done on the frontend because of the client secret. So what I have done is that when a user clicks a button, axios sends a get request to my backend server. Then, the server initiates the POST request as detailed in the docs above.
I’m not sure if this is the right way to do this, but I don’t think it is. It is currently giving me a 401 unauthorized error. However, when I test this request on postman, it works fine. So I’m guessing I’m doing the request in the wrong “environment”.
Is axios supposed to be used on the backend? And it seems sort of repetitive that I have to do two requests to get one response.