# 登錄
> 下文所有的`www.zhangpn.com`全部代表本機localhost,可以配置host文件,也可以改為localhost
```http
POST /login?username=user&password=user HTTP/1.1
Host: www.zhangpn.com:8001
```
# 獲取授權碼
打開谷歌瀏覽器(火狐、IE等),鍵入如下地址回車:[直接點擊](http://localhost:8001/oauth/authorize?response_type=code&client_id=web&redirect_uri=http://www.baidu.com)
```http
http://www.zhangpn.com:8001/oauth/authorize?response_type=code&client_id=web&redirect_uri=http://www.baidu.com
```
> https://www.baidu.com/?code=UXVa5a 獲取到code【UXVa5a】
# 授權碼模式
```http
POST /oauth/token?grant_type=authorization_code&code=UXVa5a&client_id=web&client_secret=web&redirect_uri=http://www.baidu.com HTTP/1.1
Host: www.zhangpn.com:8001
```
# 密碼模式
```http
POST /oauth/token?username=user&password=user&grant_type=password&scope=all&client_id=web&client_secret=web HTTP/1.1
Host: www.zhangpn.com:8001
```
# 客戶端模式
```http
POST /oauth/token?grant_type=client_credentials&scope=all&client_id=web&client_secret=web HTTP/1.1
Host: www.zhangpn.com:8001
```