i’m gettting token following the official page: Get Management API Access Tokens for Production
let obtainToken = {
method: "POST",
url: `https://${CLIENT_DOMAIN}/oauth/token`,
headers: { "content-type": "application/x-www-form-urlencoded" },
data: new URLSearchParams({
grant_type: "client_credentials",
client_id: CLIENT_ID,
client_secret: CLIENT_SECRET,
audience: `https://${CLIENT_DOMAIN}/api/v2/`,
}),
};
but this token is not working with
let options = {
method: "POST",
url: `https://${CLIENT_DOMAIN}/api/v2/users/${userId}/roles`,
headers: {
"content-type": "application/json",
authorization: `Bearer ${token}`,
"cache-control": "no-cache",
},
data: { roles: [DEFAULT_ROLE_ID] },
};
but the token from the dashboard works. not sure why.
machine-machine is set and enabled. only thing don’t understand is that token obtained from api not working but only the token in dashboard works.
