cassonchris
cassonchris

Reputation: 91

How can you create a shared secret for IdentityServer4?

All the documentation and examples I've seen all use C# code to generate the secret, like this:

new Secret("secret".Sha256())

This is fine for an initial setup and inserting into the database on startup, but what if I want to add a secret directly to the database at run time. Preferably I'd like to give instructions to a customer that doesn't involve any code.

I've tried using online tools to hash the string then Base64 encode the string but it's not matching what the code generates so I think I'm missing a step.

Upvotes: 4

Views: 2015

Answers (1)

mackie
mackie

Reputation: 5264

The code for that function is here:

https://github.com/IdentityServer/IdentityServer4/blob/master/src/IdentityServer4/src/Extensions/HashExtensions.cs

You could create a tool or library of your own that meets your requirements. We have a SQL implementation so we can easily import clients directly into our DB should we need to.

Upvotes: 4

Related Questions