Did you try this article?
How to use OAuth2/OpenIDConnect flow as sessionless, without cookies
When I use the OpenIDConnect authentication flow for a .NET Core 6 app, it only supports doing so with cookies, leveraging a session to store the information. If I want to create a microservice implementation that is stateless, and does not use sessions, how can I use OpenIDConnect?
3 answers
Sort by: Most helpful
-
-
SurferOnWww 4,156 Reputation points
2023-08-15T01:07:05.8233333+00:00 Can the following Duende Software document help?
Protecting an API using Client Credentials
The above document describes the token-based (not cookie-based) authentication using the OpenID Connect protocol.
-
Bruce (SqlWork.com) 74,851 Reputation points
2023-08-15T15:40:59.38+00:00 a persistent storage is only required if the web service needs to make an api call on the behalf of a user (get token silently). in this case the user access (and refresh) token is stored for use with subsequent requests. if your service does not need a user access token, then no session is required. the cookie has the user identification.
but a micro-service is not typically a browser web site, its an api. I would expect it to use bearer tokens rather than cookie authentication. this does not require session.