问题
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-client-js-to-use-the-OpenID-Connect-Authorization-Code-Flow-and-PKCE to implement OIDC in SPA(Angular)
I am using aspboilerplate integrated IdentityServer
I've set up everything as per the above articles and I was able to navigate to external auth provider and was also able to enter the required credentials.
While redirecting to angular I am getting 400 - Bad request. Here are the details
Call back URL :
http://localhost:4200/auth-callback?code=b74f38054d4becadaa3c45ce58a83c892e0d25e7fc4bfcc1ef29ce369b477596&scope=openid%20profile%20api1&state=18af0415b22b4614882d3e31113e2717&session_state=yP4rCdCetarKTsX6X0JXYTeV_1Xo8dud9V2FnT-14QE.db913b7a39e26220d8ac07de5a523eb2
Cookies : Request sent 9095 bytes of Cookie data:
.AspNetCore.Antiforgery.xkdte50z5pg=CfDJ8FAKJpEizERFtUzdjBClgctpGC-BWtg81DZ33kUapCDBb84U7ILfbqhExQzI3oVOWReKh72cV8hdROZcCh6wK7tbwl14PnWzNIECZGxyYx-K3MINQnZEp3cp-Ury1Z4KaRHs7mqvmf6oc30h6Q-oFxI
idsrv.external=chunks-2
idsrv.externalC1=CfDJ8FAKJpEizERFtUzdjBClgcum3jNb_Pj5sm5cfWLtKGcBqkU1VIUHlMdupOgnYwqTNw3bjxOoeVbCR1YR9y6Y2Q6zZvxX2juNv1iiUTwVIcTAG99R0QU8Ki1EJ8uOvaVN-BgUFNXYzcrct69nxfTGj5Ay2wL18-ziLczxnqurAbgTVkgyZs6IWHgtbOwyoyJb3klbQUkt4nmNZbwNSzeYknhDq7ohwEqeva51TIw73lciD2bJpJZnxUFx9eRI7FiJcf6qM3iYzvQ9R1-IRAmTleGEul_KY0eEcf8srxjPDgCRvj_Chy14N0rJdvWvrgio2yfdKTiCam2y-xPporU1oBOupt4zuaKsnPlHzzY9NksO_Gp7TTXJi91d3P2rl9FtBbQVQQDgpuNlwKO_WWIbd_nvcns647_0Cm0-mXiPecFrC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B6Q5rX_qzcvqwyldPn1xJyXealA5KCi38hqsI0wy5-LZhiIUt6PEQX_WNF5wiL9jkT_6-qVfUhlRB87tcqx6YHwdwlYUErsNkrRwZJQrtXxDJoZwEWYy31Ehpi2XVoKTksNGdvHbJcPtFBt7BactgMy6MRu0LVTI8XFhVaG-9LaiHAq9U3c2vblpNjdlBW0nrujZo5MaV5xroyrL3PxZ3j9oj3FzbtgcN_ys5J8FMdhTBAaN5V_YtAWpBH1kP527q_raw1wWdnIvLKQk9hsQJqdldZoKM6mZgyE5_lAWzLs1KN4xwD7Gbz3uQVoaIdIGGsW1iXhB6wJ7WeN9vD6kAJBiI9aHn_iJLmh-QPEWPdMntVipec4UXAACVXPX_QmOvFYxdVhSQp9tdmzpvAfVpQpsbrF29ro0olru0Aimv73wMp4UtIacGSu2T7rHfwkXJ05o9IDuUnjOC9oXMhxLvz_dBwjHeHt_B3BvBQ-XNSEQra0fD0MzJ3GBRqK1vUWRJQzaUmfZF5aE39az8qoRZBAYKFrAzqE8Y2IsEK6UhrJj4QuJ03l_skguhXuraLyH-IO6fnRqF5lZQgO81RIZKDvRlhNrcGJsM6yOotUXXTpVz9xjOtn1rMO1woO0up8kr16vlcRKp_TUh_VqDvV-AbY93ZYBUuvVUiLonGaOK7V3X7uqJGFsh0f27hy7CKYyjviPLo9eEs_oMsjh34cLEzDEPSZtgdqbv6_82ruVRA6S5wKWr6v3HluBVjJP7Q8iBJbLzFfl85ihIjj04hYZQmBUx0E0a646NVETdibYC7zcmdtGOUb045Nifb3A
IdentityServer Config :
public static class IdentityServerConfig
{
public static IEnumerable<ApiResource> GetApiResources()
{
return new List<ApiResource>
{
new ApiResource("api1", "My API")
};
}
public static IEnumerable<IdentityResource> GetIdentityResources()
{
return new List<IdentityResource>
{
new IdentityResources.OpenId(),
new IdentityResources.Profile()
};
}
public static IEnumerable<Client> GetClients()
{
return new List<Client>
{
new Client
{
ClientId = "angular_spa",
ClientName = "Angular 4 Client",
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
RequireClientSecret = false,
AllowedScopes = new List<string> {"openid", "profile", "api1"},
RedirectUris = new List<string> {"http://localhost:4200/auth-callback", "http://localhost:4200/silent-refresh.html"},
PostLogoutRedirectUris = new List<string> {"http://localhost:4200/"},
AllowedCorsOrigins = new List<string> {"http://localhost:4200"},
AllowAccessTokensViaBrowser = true
}
};
}
}
Angular Configurations :
export function getClientSettings(): UserManagerSettings {
return {
authority: 'http://localhost:44380/',
client_id: 'angular_spa',
redirect_uri: 'http://localhost:4200/auth-callback',
post_logout_redirect_uri: 'http://localhost:4200/',
response_type: "code",
scope: "openid profile api1",
filterProtocolClaims: true,
loadUserInfo: true
};
}
Kindly let me know what could have gone wrong
Edit: What I've found so far is
- Even with another Angular oidc client
angular-auth-oidc-client
, I am stuck in the same error - With JS client, (https://github.com/IdentityServer/IdentityServer4/tree/master/samples/Quickstarts/6_JavaScriptClient), it is working as expected. but since we have Angular as front end, I implemented the JS sample in Angular by including the required JS library and to my surprise, I am facing the same issue
When I copied the URL and pasted in another browser, the
call-back
component is invoked. So it seems like there is something wrong in Header & Cookie. Here is the complete data of the request I took from FiddlerGET http://localhost:4200/call-back?code=7bc6c3d343067f2ede3ed86268e3622bb909cb8df5d75d2f223b335bd75b730c&scope=openid%20profile%20api1&state=86215491d41a4c3c83d52007edf372cd&session_state=ibjjr0YMpGp_UZ1ezmUMusoAIpht25ySKfq8hoCKHXQ.e7f8f959a82f09b830a9635911c0b9f3 HTTP/1.1
Host: localhost:4200 Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36 Sec-Fetch-Mode: navigate Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3 Sec-Fetch-Site: none Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9
Cookie: .AspNetCore.Ant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m2YXwpMnC8WFRC26VttbpNHVXIJ28AZyVvXD2t7js8EMN0GXQrtCD05hRKrDXQtquyer_Xrw9j_FkLqb9-X78bLQ7pjRx2SHGns3LiiRoPVd7TUiPgCJ46LgeDcHiRwMlyfTyzobtGXJa6qofQerRRoiKz_29jnStY9wDmZjpTVi63fB23TBJYvfFO6RPOs0b8CCJIyTMqja6ZFLVBXx0ZY0xd8b4W-szLt4n_j2MxqwzpljN8Xc5N2FZlNyFAdXWk6T31a_sI6_I-enWIeO3BjlExvuDQC-Tt9wR8PJlLThRvT_qxJbQpe3xsQ
HTTP/1.1 400 Bad Request Connection: close
This is what I see in the browser
回答1:
As you already find out the exact problem is of header limit and solve it by limiting cookie size but limiting cookie size may not be a solution everytime.Main reason behind why angular doesn't accept large header data is bcs angular use node serve webpack-dev-server
and there is limit on header size in node js you can find related issue bellow
ng serve fails to serve pages when large cookies are present
400 Bad request due to Node limiting header size to 8kB
Update npm run to fix hpe_header_overflow in recent nodejs versions
Make HTTP_MAX_HEADER_SIZE configurable
So instead of using ng serve
using command
node --max-http-header-size=16385 ./node_modules/@angular/cli/bin/ng serve
should be the solution to your problem
回答2:
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
- If someone can share why Angular isn't accepting large header data while it works perfectly with JS client.
- 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.
回答3:
Just try with few fixes.
First - RedirectUris
seems suspicious, since it contains more than one value, - according to the http://docs.identityserver.io/en/latest/topics/clients.html - declaring this as a List<string>
could be the source of the issues.
Next, following the example of server side config https://github.com/IdentityServer/IdentityServer4.Demo/blob/master/src/IdentityServer4Demo/Config.cs
new Client
{
...
RequireClientSecret = false,
RequireConsent = false,
AllowedGrantTypes = GrantTypes.Code,
AllowedScopes = { "openid", "profile", "email", "api" },
AllowOfflineAccess = true,
RefreshTokenUsage = TokenUsage.ReUse
}
Let's assume that AllowedScopes
should include mandatory email
scope,
then GetIdentityResources()
needs last fix:
public static IEnumerable<IdentityResource> GetIdentityResources()
{
return new List<IdentityResource>
{
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
new IdentityResources.Email(),
};
}
Since SPA code is out of scope here, for proper flow implementation please follow the examples:
https://github.com/IdentityServer/IdentityServer4.Demo/,
回答4:
Perhaps you mixed something up in routes or redirect_url configuration?
Based on configuration of the client and server you posted, redirect_url
should be:
http://localhost:4200/auth-callback`
Yet, in the screenshot path is /call-back
, not /auth-callback
.
I would check if configurations (client and server) and Angular router all have same path /auth-callback
configured.
来源:https://stackoverflow.com/questions/57552543/identityserver-external-auth-provider-auth-callback-redirection-400-bad-re