我从Spring OAuth2开始.我想以app/json格式将用户名和密码发送到POST正文中的/ oauth/token端点.
curl -X POST -H "Authorization: Basic YWNtZTphY21lc2VjcmV0" -H "Content-Type: application/json" -d '{
"username": "user",
"password": "password",
"grant_type": "password"
}' "http://localhost:9999/api/oauth/token"
Run Code Online (Sandbox Code Playgroud)
那可能吗?
你能给我一个建议吗?
我从Spring OAuth2开始.到目前为止,我已经使用配置保护了我的应用程序.但我有一个问题,我的客户端不支持HTTP基本授权.
有没有办法如何为/ oauth/token端点禁用HTTP Basic Auth?我想在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"
Run Code Online (Sandbox Code Playgroud)
要么
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"
Run Code Online (Sandbox Code Playgroud) spring oauth spring-security spring-security-oauth2 spring-oauth2