I am using Scoruba IdentityServer (Scoruba IDP) for authentication in my ASP.NET Core 6 application. The following code works perfectly in my DEV/TEST environments, but it fails in the production environment. I’ve been searching for a solution for two days without success. Can anyone help me figure out what’s going wrong?
Here is the relevant code:
C#
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
var accessToken = await context.HttpContext.GetTokenAsync("access_token");
_logger.LogError("accessToken: " + accessToken);
// additional logic
}
In production, GetTokenAsync
doesn’t return the expected token. I have verified that the authentication flow is working correctly and that the token is being issued.
Environment details:
DEV/TEST: ASP.NET Core 6
What I have tried:
- Verified the token issuance and its presence in the request.
- Checked the production configuration to ensure it matches the DEV/TEST environments.
- Ensured that all required scopes and claims are included in the token.
Additional information:
There are no errors or exceptions thrown, but the accessToken
variable is null in production.
Any help or pointers would be greatly appreciated!
Thank you in advance.
I also tried using IHttpContextAccessor
from DI to get the token, but I got the same result
2