Followed the docs exactly for access tokens and get 401 errors!

I am new and have followed the docs to get an access token using the doc generated code with all the right app creds etc as screenshots below but keep getting a 401 error, do I need to config the users in anyway?this is driving me crazy , can any Auth0 staff please put me on the right path please?

Hello @jamie.warnock

I would recommend using the following code:

`var request = require(“request”);

var options = { method: ‘POST’,
url: ‘https://YOUR_DOMAIN/oauth/token’,
headers: { ‘content-type’: ‘application/x-www-form-urlencoded’ },
form:
{ client_id: ‘YOUR_CLIENT_ID’,
client_secret: ‘YOUR_CLIENT_SECRET’,
audience: ‘API_IDENTIFIER’,
grant_type: ‘client_credentials’ }
};

request(options, function (error, response, body) {
if (error) throw new Error(error);

console.log(body);
});`

Can you provide the complete response you are getting?

Thanks!

Hello Karen,

Thanks for your reply, but I have tried that code from your docs and because it is a clientside NuxtJS app could not use the request library as it is server side node.js module, but I hoped axios being clientside would work to make the HTTP request, also I have been advised by one of your colleagues I need to setup a proxy API to redirect the request from Auth0 to, bit beyond me but looking into it!

Thanks,
Jamie