获取授权码:https://oauth.taobao.com/authorize
参数:
client_id 必选 值 : 你的appkey的值
response_type 必选 值 : code
redirect_uri 必选 值 : urn:ietf:wg:oauth:2.0:oob
最终地址 :
https://oauth.taobao.com/authorize?client_id=你的appkey&response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob
获取访问令牌:
client_id 必选 值 : appkey的值
client_secret 必选 值 : appsecret
grant_type 必选 值 : authorization_code
code 必选 值 : 授权码
redirect_uri 必选 值 : urn:ietf:wg:oauth:2.0:oob
最终地址:
https://oauth.taobao.com/token?client_id=appkey的值&client_secret=appsecret&grant_type=authorization_code&code=授权码&redirect_uri=urn:ietf:wg:oauth:2.0:oob
获取相关信息 : refresh_token access_token
参数:
client_id 必选 值 : 你的appkey的值
response_type 必选 值 : code
redirect_uri 必选 值 : urn:ietf:wg:oauth:2.0:oob
最终地址 :
https://oauth.taobao.com/authorize?client_id=你的appkey&response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob
获取访问令牌:
client_id 必选 值 : appkey的值
client_secret 必选 值 : appsecret
grant_type 必选 值 : authorization_code
code 必选 值 : 授权码
redirect_uri 必选 值 : urn:ietf:wg:oauth:2.0:oob
最终地址:
https://oauth.taobao.com/token?client_id=appkey的值&client_secret=appsecret&grant_type=authorization_code&code=授权码&redirect_uri=urn:ietf:wg:oauth:2.0:oob
获取相关信息 : refresh_token access_token
public static String getToken() throws IOException {
String url = "";
Map<String, String> param = new HashMap<String, String>();
param.put("grant_type", "authorization_code");
param.put("code", "授权码");
param.put("client_id", "appKey");
param.put("client_secret", "appSecret");
param.put("redirect_uri", "redirect_uri");
param.put("view", "web");
param.put("state", "state");
String responseJson = WebUtils.doPost(url, param, 3000, 3000);
return responseJson;
}
public static void main(String[] args) {
try {
System.out.println(GetToken.getToken());;
} catch (IOException e) {
e.printStackTrace();
}
}