我可以通过网络浏览器成功呼叫我的Api。使用IdentityModel工作正常。 但是当我尝试通过Fiddler调用Api时,我得到invalid_client。我的客户端信息来自基于MembershipReboot客户端表的数据库。
我尝试通过Post Body和身份验证基本传递数据。两者都失败了。
使用Authentication Basic编码参数进行呼叫时,我有以下>
User-Agent: Fiddler
Host: qaquasaridentity
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
Authorization: Basic dGVzdC5hcGk6c2VjcmV0
Fiddler中的实际编码值显示:
No Proxy-Authorization Header is present.
Authorization Header is present: Basic dGVzdC5hcGk6c2VjcmV0
Decoded Username:Password= test.api:secret
当我使用Post Body调用参数时,传递的数据是:
client_id=test.api
&client_secret=secret
&grant_type=client_credentials
&scope=testapi
服务器日志说
2017-01-20 12:06:13.968 -06:00 [Debug] Start client validation
2017-01-20 12:06:13.971 -06:00 [Debug] Start parsing Basic Authentication secret
2017-01-20 12:06:13.973 -06:00 [Debug] Start parsing for secret in post body
2017-01-20 12:06:13.973 -06:00 [Debug] No secret in post body found
2017-01-20 12:06:13.976 -06:00 [Debug] Start parsing for X.509 certificate
2017-01-20 12:06:13.976 -06:00 [Debug] client_id is not found in post body
w3wp.exe Information: 0 : 2017-01-20 12:06:13.976 -06:00 [Information] Parser found no secret
w3wp.exe Information: 0 : 2017-01-20 12:06:13.981 -06:00 [Information] No client secret found
w3wp.exe Information: 0 : 2017-01-20 12:06:13.983 -06:00 [Information] End token request
w3wp.exe Information: 0 : 2017-01-20 12:06:13.988 -06:00 [Information] Returning error: invalid_client
我有client_id和client_secret,但错误日志另有说明。 谁能解释我做错了什么?我可以通过后端的.NET获取access_token,但不能通过Fiddler获取。
答案 0 :(得分:1)
POST /connect/token
grant_type=client_credentials&client_id=test.api&client_secret=secret&scope=api
http://openid.net/specs/openid-connect-core-1_0.html#TokenRequest https://identityserver.github.io/Documentation/docsv2/endpoints/token.html