Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicsDataAccessLayer unauthorized due to token expiration #49

Open
MTH2021 opened this issue Jul 29, 2021 · 0 comments
Open

DynamicsDataAccessLayer unauthorized due to token expiration #49

MTH2021 opened this issue Jul 29, 2021 · 0 comments

Comments

@MTH2021
Copy link

MTH2021 commented Jul 29, 2021

I have been using the Smart Assist Bot since it has come out. We have had no issues with the Bot using the API calls to D365 CE. However, in the last few months, the API calls stopped working due to an "unauthorized" error. It appears that the Access Token expires and a new one is not acquired until we restart the Bots App Services. The App Registration Secret is not expired. CORS is set correctly.

The API calls work for about 3 hours and then they stop due to unauthorized access. Again, this has been working for months and then this started a couple months ago.

Do I need to add code to Acquire a new Access Token each time? And, if so, how would I do this.

MS Ticket Logs:
traceName: LogAccessDenied ; area: Owin.AuthN ; layer: S2SSecurityTokenHandler ; message: empty ; exception: System.IdentityModel.Tokens.SecurityTokenExpiredException: IDX10223: Lifetime validation failed. The token is expired.
ValidTo: '07/28/2021 14:57:27'
Current time: '07/28/2021 15:22:00'.
at System.IdentityModel.Tokens.Validators.ValidateLifetime(Nullable1 notBefore, Nullable1 expires, SecurityToken securityToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateLifetime(Nullable1 notBefore, Nullable1 expires, SecurityToken securityToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
at Microsoft.Crm.Authentication.Owin.TokenHandlers.BaseSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
System.IdentityModel.Tokens.SecurityTokenExpiredException: IDX10223: Lifetime validation failed. The token is expired.
ValidTo: '07/28/2021 14:57:27'
Current time: '07/28/2021 15:22:00'.
at System.IdentityModel.Tokens.Validators.ValidateLifetime(Nullable1 notBefore, Nullable1 expires, SecurityToken securityToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateLifetime(Nullable1 notBefore, Nullable1 expires, SecurityToken securityToken, TokenValidationParameters validationParameters)
at System.IdentityModel.Tokens.JwtSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
at Microsoft.Crm.Authentication.Owin.TokenHandlers.BaseSecurityTokenHandler.ValidateToken(String securityToken, TokenValidationParameters validationParameters, SecurityToken& validatedToken)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant