Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Client secret validation failed for client' error on identity server 4

I'm trying to get an access token from my Identity Server 4 with client_credentials , i think i almost finished the Google pages with my search and i found nothing. So please:

This is my GetClients method

[![enter image description here][1]][1]My PostMan Request, in the header i have only the Content_Type which is application/x-www-form-urlencoded enter image description here

And the error :

enter image description here

like image 582
TrulyXax Avatar asked May 21 '19 10:05

TrulyXax


1 Answers

You started with the correct row of code: "secret".Sha256() but later forgot it.
Try the following:

var secret = new Secret {Value = "test".Sha512()};
ClientSecrets = new[] {secret};

The secret must be hashed.

Briefly tested with

curl https://localhost:5001/connect/token -d "grant_type=client_credentials&client_id=azure-client-id&client_secret=test"

and

curl https://localhost:5001/connect/token -H "Authorization: Basic YXp1cmUtY2xpZW50LWlkOnRlc3Q=" -d "grant_type=client_credentials"

like image 64
d_f Avatar answered Nov 13 '22 04:11

d_f