misso
1 get cookie
如果还没有拿到cookie,可以访问任一页面,404也可以,
在头部获取Set-Cookie,得到服务器下发的cookie字段,cookie字段失效后,重复这一步骤,获取新的cookie
HTTP/1.1 404 Not Found
Server: nginx
Date: Wed, 03 May 2017 07:36:53 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: falconSessionId=c528603c1543b80da74b586f36c45f21; Path=/; Expires=Thu, 04 May 2017 07:36:53 GMT; Max-Age=86400; HttpOnly
Content-Length: 2000
2 use cookie
得到cookie之后,需要在所有的请求头部,加入cookie,包括认证,api调用,退出登录,方法如下
- cookie失效,重复步骤1
get /v1.0/auth/callback/misso HTTP/1.1
Host: ctrl.dev
Connection: keep-alive
Content-Length: 0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/53.0.2785.143 Chrome/53.0.2785.143 Safari/537.36
Content-Type: application/json
Referer: http://ctrl.dev/doc/
Accept-Encoding: gzip, deflate
Accept-Language: zh,zh-CN;q=0.8
Cookie: falconSessionId=c528603c1543b80da74b586f36c45f21
3 auth
如果访问api出现401 Unauthorized, 需要认证,方法如下
-
get
方式访问/v1.0/auth/callback/misso
- 头部加入 Authorization
- 头部加入cookie
- cookie失效,重复步骤1
get /v1.0/auth/callback/misso HTTP/1.1
Host: ctrl.dev
Connection: keep-alive
Content-Length: 0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/53.0.2785.143 Chrome/53.0.2785.143 Safari/537.36
Content-Type: application/json
Referer: http://ctrl.dev/doc/
Accept-Encoding: gzip, deflate
Accept-Language: zh,zh-CN;q=0.8
Cookie: falconSessionId=c528603c1543b80da74b586f36c45f21
Authorization: xxxoooxxxooxoxoxoxoxoxoxoxoxo
4 访问api
- 头部加入有效期内,并完成过步骤3的cookie
- 出现401错误后,重复步骤3
get /v1.0/auth/info HTTP/1.1
Host: ctrl.dev
Connection: keep-alive
Content-Length: 0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/53.0.2785.143 Chrome/53.0.2785.143 Safari/537.36
Content-Type: application/json
Referer: http://ctrl.dev/doc/
Accept-Encoding: gzip, deflate
Accept-Language: zh,zh-CN;q=0.8
Cookie: falconSessionId=c528603c1543b80da74b586f36c45f21