Forum Discussion

punkaj_ahuja's avatar
punkaj_ahuja
Copper Contributor
Jul 27, 2023

Error while authenticating Azure App Service - Invalid Grant.

Hi,

I have developed an Azure App Service with .Net Core 6.0 MVC. I am trying to authenticate the user from below code:

 

 

 

There is an app registration created and I have set the redirect URL to below -


The issue I am facing is when the users try to access the app service via browser, after providing their credentials and doing their MFA the system takes multiple attempts to login but end up showing below error message:

 


I traced the logs in Azure Application Insight and get following errors and exceptions when user tries to login:

 

Traces:

 

 

 

 

 

Exceptions:

 

 

 

The exception message suggest that authorization code is being used again after being redeemed once, and then becomes invalid.  But there is no code I have written for getting any authorization code and trying to redeem to get access token. All I have is the code specified above (using "builder.Services.AddAuthentication"  function. I assume the process to generate authentication code is being done automatically while redirecting to "https://..../signin-oidc". 

 

Please can someone suggest what could be the cause of this error and how to resolve it?

 

 

Thanks in advance.

 

Regards

Punkaj

 

 

No RepliesBe the first to reply

Resources