Client Credentials

Client Credentials

环境与入口

生产issuer为 https://accounts.appforges.com,staging为 https://accounts-staging.appforges.com。浏览器用户授权入口是对应issuer的 /oauth2/authorize,token交换是 /oauth2/token。用户业务API为对应环境的api域名;不要把REST /v1/oauth/authorize 当成浏览器登录入口。

在应用Credentials创建OAuth client,配置Public/Confidential模式、redirect URIs与allowed scopes。复制实际client_id,不把app_id当成client_id。Public client使用PKCE S256且不持有client_secret;Confidential secret只放安全后端。

服务调用

client_credentials适用于已登记此grant的Confidential client及支持服务主体的端点。使用登记的token认证方式,在issuer的token endpoint提交grant_type=client_credentials及已允许的scope;不要假设任意应用自动具备此grant。

服务token不能调用要求用户主体的 GET /v1/users/me。目标端点允许的身份、凭据和scope查看API Reference,token过期时重新申请,不假设得到refresh_token。

需要用户身份时切换用户授权流程。