Welcome to the Auth0 Community!
I understand you encountered the 401 Unauthorized error when requesting access tokens from your application.
First, could you please share your complete /oauth/token
request with me?
And could you please verify that you have enabled your application to use this API? You can check by navigating to your Auth0 Dashboard > Applications > APIs and clicking on the Machine-to-Machine tab.
On there, find your application and enable it. Then, expand the permission settings and select the permissions (scopes) for this client. Then retry the /oauth/token
request.
Please let me know how this works for you.
Thank you.