0

我正在尝试使用简单的 CURL 命令从 Spring OAuth 2.0 授权服务器获取授权代码。

curl -v --header "Authorization: Basic hasfhfashfakhsfakhf712641246" "http://0.0.0.0:0000/oauth-server/oauth2/authorize?response_type=code&client_id=dummyclient&client_secret=dummyclient&redirect_uri=http://oauth2server/oauth2callback/"

但是,我没有返回带有代码的重定向 URL,而是返回对登录 URL 的 302 重定向响应。由于我已经在 Authorization Header 中发送了用户名、密码,有没有办法跳过登录页面重定向并直接获取授权码?

4

1 回答 1

0

您可能需要告诉 curl 使用-L标志跟随重定向

curl -L -v --header "Authorization: Basic hasfhfashfakhsfakhf712641246" "http://0.0.0.0:0000/oauth-server/oauth2/authorize?response_type=code&client_id=dummyclient&client_secret=dummyclient&redirect_uri=http://oauth2server/oauth2callback/"
于 2016-04-14T19:41:32.103 回答