如何验证OAuth2 + PCKE流的访问令牌

问题描述 投票:0回答:2

根据这份文件https://developers.onelogin.com/openid-connect/guides/auth-flow-pkce

PCKE流的令牌端点为无(非基本或POST)

enter image description here

那么,我如何使用验证令牌API https://developers.onelogin.com/openid-connect/api/validate-session,因为它支持Basic authenticationPOST但不支持None (PCKE)我找不到任何与此相关的信息。

注意:我尝试使用基本身份验证请求,没有+ client_id,client_secret作为参数但不起作用。

回复401未经授权

{
    "error": "invalid_client",
    "error_description": "client authentication failed"
}
api session login token onelogin
2个回答
2
投票

我正在使用OIDC和PKCE,我设法通过授权代码流检索到的令牌调用https://openid-connect.onelogin.com/oidc/token/introspection端点:

$ curl -i -d "token=...&token_type_hint=access_token&client_id=..." https://openid-connect.onelogin.com/oidc/token/introspection

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Length: 304
Content-Type: application/json; charset=utf-8
Date: Thu, 25 Apr 2019 23:37:42 GMT
Pragma: no-cache
X-Powered-By: Express
Set-Cookie: ol_oidc_canary_040819=false; path=/; domain=.onelogin.com

{"active":true,"sub":"...","client_id":"...","exp":1558819177,"iat":1556227177,"sid":"...","iss":"https://openid-connect.onelogin.com/oidc","jti":"...","scope":"openid profile email"}

access_tokenrefresh_token从auth代码流https://developers.onelogin.com/openid-connect/api/authorization-code-grant返回工作,并且access_token在它过期后才返回{"active":false}

确保您没有设置Authorization标头,只在有效负载中设置client_id


1
投票

在POST正文中使用client_id和code_verify。这将验证该端点上的请求。

© www.soinside.com 2019 - 2024. All rights reserved.