A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
I think you have too much code in your authentication configuration. The official sample code is much leaner. Maybe some of your customizations are affecting the post-authentication flow.
The default cookie options usually work fine without customizations. And I have never stored or restored correlation IDs in session. Those IDs usually work fine in cookies and parameters.
Besides, the sample code for OpenID handles the synchronization of users in the OnSignedIn event, not in the OnTokenValidated.
I suggest you try replacing your integration with the sample code, even though the sample code is angled at Entra ID. Then just make Okta-related adjustments through configuration (by setting properties).
Hi,
I'm running into an issue with Okta authentication in my ASP.NET Core application. Here's the scenario:
When a user accesses a direct URL (e.g., an image, PDF, or a specific page), the authentication flow correctly redirects them to Okta for login.
After successful authentication, Okta redirects back to the /signin-oidc endpoint.
However, at this point, the ASP.NET Core authentication cookies that are normally created during a standard login flow are not being properly created or persisted.
This issue only occurs when accessing direct URLs. The normal login flow works fine and sets the cookies correctly.
Interestingly, this works perfectly in my development environment—even unauthenticated users can access the files and the cookies are set as expected. But in the deployed environment, the cookies are missing after the callback.
Here’s a snippet of my Okta extension class that I’m calling from Startup.cs:
Questions:
1- Is there something missing in the Okta authentication setup that would prevent cookies from being created on the callback?
2- Could this be related to SameSite cookie settings, HTTPS enforcement, or something environment-specific?
3- Any suggestions on how to debug or log the cookie creation process during the callback?
Would appreciate any inputs on this.
Regards.