Skip to content

Instantly share code, notes, and snippets.

@zyjibmcn
Last active July 21, 2016 06:37
Show Gist options
  • Save zyjibmcn/ff4168ec32bda9e41b28b5bce9137c6c to your computer and use it in GitHub Desktop.
Save zyjibmcn/ff4168ec32bda9e41b28b5bce9137c6c to your computer and use it in GitHub Desktop.
curl - 访问protected APIs

=== 适用于基于cookie的SSO保护的resources

访问一个auth-basic页面,保存cookies到文件

curl --insecure --user "username:password" --cookie-jar api_token.txt https://hostname/auth-basic

使用已获取的cookie (ltpa_token2)访问API

curl --insecure --cookie api_token.txt https://hostname/api/xxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment