Access token request error: Error: Request failed with status code 401

Dear experts,

I am trying to get a custom DB connected. The DB is accessible via an API protected by an Auth0 M2M application. Using Postman, I can authenticate against the Auth0 application to get an access token for the API call. However, when I use exactly the same request within the custom DB login script, I get the error mentioned in the topic title.
Here is the axios call I use to authenticate and the axios interceptor output for the request (uppercase words are placeholders):'https://AUTH0_TENANT_URL/oauth/token', {
    grant_type: 'client_credentials',
    audience: 'AUTH0_API_ID',
    client_id: 'AUTH0_M2M_APP_CLIENT_ID',
    client_secret: 'AUTH0_M2M_APP_CLIENT_SECRET'
	}, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
4:11:02 PM:
 Starting Request {
"transformRequest": {},
"transformResponse": {},
"headers": {
"common": {
"Accept": "application/json, text/plain, */*"
"patch": {
"Content-Type": "application/x-www-form-urlencoded"
"post": {
"Content-Type": "application/x-www-form-urlencoded"
"put": {
"Content-Type": "application/x-www-form-urlencoded"
"Content-Type": "application/x-www-form-urlencoded"
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"method": "post",
"url": "https://AUTH0_TENANT_URL/oauth/token",
"data": {
"grant_type": "client_credentials",
"audience": "AUTH0_API_ID",
"client_id": "AUTH0_M2M_APP_CLIENT_ID",
"client_secret": "AUTH0_M2M_APP_CLIENT_SECRET"

Thanks in advance for your expertise,

Fixed. It was a duplicate of this issue

1 Like

Thanks for sharing a follow up!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.