## 一、概述
開發平臺的接口,分為兩類,一類需要用戶授權,一類不需要用戶授權即可;
## 二、需用戶授權接口
### **獲取授權碼**
API:/platform/oauth/connect/
> 參數中,redirect_uri需要特別注意,這個參數只要域名部分與應用注冊的時候,授權域回調的域名配置一致,后面可以帶參數或路徑都可以;
實例:
授權域回調配置為:http://www.abc.com/
API拼湊的URL為:
https://open.douyin.com/platform/oauth/connect/?client_key=aw0haqdl4fljkhaw&response_type=code&scope=user_info&redirect_uri=http://www.abc.com/api/system
訪問上述地址,顯示二維碼,用抖音APP掃碼后,得到授權,并重定向到http://www.abc.com/api/system
地址,且帶上了?code=****
### **獲取access_token**
API:/oauth/access_token/
拿到授權碼后,接著調用這個API,即可獲取到access_token;
API拼湊的URL為:https://open.douyin.com/oauth/access_token//?client_key=*****&client_secret=*****&grant_type=authorization_code&code=04a95b204ab1dc16DVAbpAIyyTbWZYxhX0QP

到這里,拿到access_token,就可以調用需要用戶授權的接口了;
## 三、免用戶授權需接口
### **獲取client_token**
獲取接口調用的憑證client_access_token,用于調用**不需要用戶授權**就可以調用的接口;
API:/oauth/client_token/
API拼湊的URL為:https://open.douyin.com/oauth/client_token/?client_key=*****&client_secret=*****&grant_type=client_credential

## 四、調用接口實例
以獲取用戶信息(需要用戶授權)為例說明:
1、獲取到用戶授權的code;
2、基于code,獲取access_token(包含openId);
3、基于access_token和openId,獲取用戶信息即可;

## 五、總結
對于需用戶授權的接口,調用過程為:獲取code->換AccessToken->調用接口;
對于免用戶授權的接口,調用過程為:獲取ClientToken->調用接口;