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。

需要用戶身份時切換用戶授權流程。