All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pdd.pop.sdk.http.demo.AccessTokenDemo Maven / Gradle / Ivy

There is a newer version: 1.10.85
Show newest version
package com.pdd.pop.sdk.http.demo;

import com.pdd.pop.sdk.http.PopAccessTokenClient;
import com.pdd.pop.sdk.http.token.AccessTokenResponse;

/**
 * @author xuanli
 * @Description: TODO
 * @date 2018/12/4 19:34
 */
public class AccessTokenDemo {
    
    public static void main(String[] args) {
        String clientId = "your app clientId";
        String clientSecret = "your app clientSecret";
        String refreshToken = "your app refreshToken";
        String code = "your code";
    
        PopAccessTokenClient accessTokenClient = new PopAccessTokenClient(clientId,clientSecret);
    
        
        // 生成AccessToken
        try {
            AccessTokenResponse response = accessTokenClient.generate(code);
        } catch (Exception e) {
            e.printStackTrace();
        }
    
    
        // 刷新AccessToken
        try {
            AccessTokenResponse response = accessTokenClient.refresh(refreshToken);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy