Hi
Guys, Auth0 is the most complex thing I have ever used. So many things needs to be discovered… Anyway, am trying to setup an Azure AD multi-tenant app and I can’t get it working. I am sure, I am missing something obvious. I have got everything working when using “Try” button from the Auth0 portal.
var webAuth = new Auth0.WebAuth({
domain: AUTH_CONFIG.domain,
clientID: AUTH_CONFIG.clientID
});
webAuth.authorize({
connection: 'digital-dealers-waad',
responseType: 'code',
redirectUri :AUTH_CONFIG.callbackURL,
prompt:"consent",
});
Where call back URL - http://localhost:4200/callback - my Angular2 App
I am getting a code:
http://localhost:4200/callback?code=ReJnUpqetKd3HR9S
Btu what to do after with that code, I have no idea. I was trying to call Azure AD with that code, but it doesn’t work
// Get the user's profile from Azure AD.
var credential = new ClientCredential("AppKey",
"AppSecret");
var authContext = new AuthenticationContext("https://login.windows.net/common/");
try
{
var result = await authContext.AcquireTokenByAuthorizationCodeAsync("ReJnUpqetKd3HR9S", new Uri("https://digital-dealers.au.auth0.com/login/callback"), credential);
}catch(Exception ex)
{
string s = ex.Message;
}
return Ok();
But it returns BadRequest saying that Code is invalid.
Please HELP!!!