package com.huimv.video.dhicc.icc;

import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.oauth.http.DefaultClient;
import com.dahuatech.icc.oauth.http.IClient;
import com.dahuatech.icc.oauth.http.IccTokenResponse;
import com.dahuatech.icc.oauth.profile.IccProfile;

public class IccUtil {
    //获取token
    public static  String getToken() throws ClientException {
        IClient iClient = new DefaultClient();
        //IccProfile 授权类型，根据你的初始化使用的password,client_credentials
        IccTokenResponse.IccToken token = iClient.getAccessToken(IccProfile.grantType);
        System.out.println(token);
        System.out.println("获取到的Token为：" + token.getAccess_token());
        return token.getAccess_token();
    }
}
