running this code will return error:
{ error: ‘invalid_grant’,
error_description: ‘Invalid username or password’ }
CODE:
var request = require(“request”);
var option = {
method: ‘POST’,
url: ‘https://mytenantname.auth0.com/oauth/token’,
headers: {
‘content-type’: content_type
},
body: {
grant_type: ‘http://auth0.com/oauth/grant-type/password-realm’,
realm: ‘test-waad’,
username: username,
password: password,
audience: audience,
scope: scope,
client_id: client_id,
client_secret: client_secret
},
json: true
};
request(options.resourceOwner, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
My application is setup with Azure AD connection.
I want to use API to return the ID Token and Access Token.
If I am using On-Prem AD, it works. Once I switch to AAD, it gives me error of “Invalid username or password”.
But I confirm that username and password are all correct.
Am I doing anything wrong? Is it the right API endpoint?
Please help.