Prevent OAuth2 scheme from returning a cookie

iKingNinja 60 Reputation points
2024-09-20T10:39:48.4766667+00:00

I have the cookie and 2 OAuth2 schemes configured in my authentication flow. I want to use the first OAuth2 scheme to sign-in/sing-up the user and the second one just to retrieve their data and save it into the database. I don't want the second OAuth2 scheme to return the authentication cookie as it overwrites the one generated by the first one.

If this is not possible is the proper solution merging the ClaimsPrincipals and then set the merge as OAuthCreatingTicketContext.Principal?

Code: https://pastebin.com/PN1hdzid (Pasting the code here weirdly cuts out some parts)

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,559 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.