package com.rndchina.aisin.util.sms;

import java.io.IOException;

/**
 * <code>Test1.java<code/>
 * <p>
 * 功能：获取令牌
 * <p>
 * Copyright 神州锐达 2014 All right reserved.
 * 
 * @Author: Brain.Hou,2014年3月11日下午1:41:03
 */
public class GetAccessToken {

	private static String grant_type = "client_credentials";
	private static String app_id = "168541270000034849";
	private static String app_secret = "d2610ec2322fc205c4a6d7669617c628";

	// 获取令牌 access_token
	public static void main(String[] args) {
		try {
			String postUrl = "https://oauth.api.189.cn/emp/oauth2/v2/access_token";
			String postEntity = "grant_type=" + grant_type + "&app_id="
					+ app_id + "&app_secret=" + app_secret;
			System.out.println("请求的地址为：" + postUrl + "?" + postEntity);
			String resJson1 = HttpInvoker.httpPost(postUrl, null, postEntity);
			System.out.println("***HHHHHH****返回的参数是：" + resJson1);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
