I’m trying to use Postman to test the Authentication Code Flow within IdentityServer4 - but it doesn’t seem to work correctly. I’m not sure if this is IS4 or a Postman issue.
My organization uses an IdentityServer4 application for authentication and we had successfully used Postman for months. As of yesterday we’ve been experiencing the same behavior.
I think it’s because some specific cookies aren’t being set in Postman for some reason. I’m pretty sure the call to HttpContext.SignInAsync() in the POST AccountController.Login() method sets the cookies which verify the user is authenticated. At that point the user should be redirect to the Consent page, which is a page that require authentication. Since the cookies that verify authentication aren’t set, the Consent page redirects the user back to the Login page, which is why it seems like the page is simply reloaded.
When I’ve attempted to access the IdentityServer4 Content page manually in Chrome, I’m redirect to Login, and after successfully Logged in, redirected back to Consent. Checking Chrome dev tools, I’ve verified that the cookies (idsrv, idsrv.session) are set.
This leads me to believe the issue is with Postman specifically.
This looks to be caused by by setting the SameSite attribute on the authorisation cookie to None. As Postman is using Chrome 66 this will reject any cookies that have this set to None.
If you don’t set the SameSite attribute for Postman requests (i.e. via User Agent detection) then it should work.