I'm pretty new to implementing authentication/authorization in my applications, so I might be missing something obvious here.
I am using Angular and oidc-client.js to communicate with my STS (IdentityServer4), and I'm setting up my angular app to log in through the Identity server, then redirect back to my client website. However I am stuck on how to send the client secret defined in my IS4 server from the client when trying to log in. I am getting an error including the following log output:
"Name": "Client Authentication Failure", "EventType": "Failure", "Id": 1011, "Message": "Invalid client secret"
I am defining my UserManager as follows:
constructor() {
const stsSettings = {
authority: Constants.stsAuthority,
client_id: Constants.clientId,
redirect_uri: `${Constants.clientRoot}signin-callback`,
scope: 'openid profile myApi',
response_type: 'code',
post_logout_redirect_uri: `${Constants.clientRoot}signout-callback`
};
this.userManager = new UserManager(stsSettings);
}
According to the documentation here there is no configuration for adding a client secret. Am I missing something here?
My Client is defined as follows in IdentityServer:
new Client
{
ClientId = "interactive",
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.Code,
RedirectUris = { "https://localhost:44300/signin-oidc" , "https://localhost:5001/signin-callback"},
FrontChannelLogoutUri = "https://localhost:44300/signout-oidc",
PostLogoutRedirectUris = { "https://localhost:44300/signout-callback-oidc", "https://localhost:5001/signout-callback" },
AllowOfflineAccess = true,
AllowedScopes = { "openid", "profile", "myApi" }
}
EDIT
I have tried passing the sha256 of "secret" (2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b) in angular both through the variable client_secret: 2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b
and as a member of extraQueryParams: { client_secret: "2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b" }
.
Neither of these scenarios are working for me.