它是Introspection Endpoint。
POST /connect/introspect
Authorization: Basic xxxyyy
token=<token>
要autorize,使用HTTP基本授權流程:結合了<scope>:<scope_secret>
對,並將其轉換爲Base64編碼的字符串(例如,在xxxyyy
上文)。所述scope_secret
值可以在ApiResource定義中指定:
new ApiResource("myapi, "My API")
{
Scopes = {new Scope("post-myapi")},
ApiSecrets = new List<Secret> {new Secret("any_string_you_like".Sha256())},
}
然後,POST請求上述應返回類似於響應:
{
"nbf": 1491850954,
"exp": 1491854554,
"iss": "api-auth",
"aud": [
"api-auth/resources",
"myapi"
],
"client_id": "foo",
"scope": "post-myapi",
"active": true
}
完整請求(來自郵差複製):
POST /connect/introspect HTTP/1.1
Host: localhost:6000
Authorization: Basic YXBpLWlzc3VlczpzY29wZVNlY3JldA==
Content-Type: application/x-www-form-urlencoded
token=.......
我嘗試在郵遞員中使用反思端點,我收到'401未經授權的',但在我的api上測試它的令牌工程。會有什麼問題? – FacundoGFlores
@FacundoFlores你有沒有註冊一個範圍祕密如上所述?我在Postman中成功地調用了這個端點,所以我添加了完整的請求來回答。 –
非常感謝!有一點很難讓我注意到,當你打電話給授權時,我需要調用'btoa(scopename:secret)'(我必須讀取控制檯日誌)。你的幫助真的很感謝! – FacundoGFlores