我从 Spring OAuth2 开始。到目前为止一切顺利,我已经通过配置保护了我的应用程序。但是我有一个问题,我的客户端不支持 HTTP 基本授权。
有没有办法为 /oauth/token 端点禁用 HTTP 基本身份验证?我想在 JSON 正文或请求标头中发送 client_id 和 client_secret。
我想工作的 curl 示例:
curl -X POST -H "Content-Type: application/json" -d '{
"username": "user",
"password": "pass",
"grant_type": "password",
"client_id": "test-client-id",
"client_secret": "test-client-secret"
}' "http://localhost:9999/api/oauth/token"
或者
curl -X POST -H "Content-Type: application/json" -H "X-Client-ID: test-client-id" -H "X-Client-Secret: test-client-secret" -d '{
"username": "user",
"password": "pass",
"grant_type": "password"
}' "http://localhost:9999/api/oauth/token"