IdentityServer External auth provider - auth-callback - Redirection - 400 Bad request

前端 未结 4 1305
孤独总比滥情好
孤独总比滥情好 2021-02-05 22:30

I am following https://www.scottbrady91.com/Angular/SPA-Authentiction-using-OpenID-Connect-Angular-CLI-and-oidc-client and https://www.scottbrady91.com/Angular/Migrating-oidc-c

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-05 22:44

    For some reason Angular do not accept that much data(Cookie) as part of Header. Though this works with JS client, I am not sure why this happens with Angular.

    During initial phase of development, for some reason, I have commented out the following lines in Account/ExternalController.cs of IdentityServer

    // delete temporary cookie used during external authentication
    await HttpContext.SignOutAsync(IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme);
    

    When this line is commented out, there will be additional Cookie that will be posted to Angular during the call back.

    Uncommented the above line will delete the temporary Cookie and there will be less header data during the call back and it invokes the respective Angular call back component and sets the bearer token.

    Clarifications Required

    1. If someone can share why Angular isn't accepting large header data while it works perfectly with JS client.
    2. Though Angular says Bad request, I was not able to find from where(which layer in Angular) this error occur is thrown. I did not even see a single line of error from which I could get some hint on reason for the error(large header data)

    If some expert could share their experience on the above couple of points, it will be really helpful to understand how Angular works.

    If for any reason, you cannot limit the header size, then increase the node's --max-http-header-size. Kindly refer https://stackoverflow.com/a/57667786/2922388 on how to do it.

提交回复
热议问题