Search in sources :

Example 1 with WebApiManager

use of com.zype.android.webapi.WebApiManager in project zype-android by zype.

the class SettingsProvider method isLogined.

public boolean isLogined() {
    // Check if Access Token needs to be refreshed
    if (isAccessTokenExpiring() == true) {
        WebApiManager webApiManager = WebApiManager.getInstance();
        AuthParamsBuilder builder = new AuthParamsBuilder();
        builder.addClientId();
        builder.addClientSecret();
        builder.addRefreshToken(SettingsProvider.getInstance().getRefreshToken());
        builder.addGrandType("refresh_token");
        webApiManager.executeRequest(WebApiManager.Request.AUTH_REFRESH_ACCESS_TOKEN, builder.build());
    }
    return !TextUtils.isEmpty(getAccessToken()) && !TextUtils.isEmpty(getRefreshToken()) && !TextUtils.isEmpty(getScope()) && !TextUtils.isEmpty(getTokenType()) && getExpiresIn() != -1L;
}
Also used : AuthParamsBuilder(com.zype.android.webapi.builder.AuthParamsBuilder) WebApiManager(com.zype.android.webapi.WebApiManager)

Aggregations

WebApiManager (com.zype.android.webapi.WebApiManager)1 AuthParamsBuilder (com.zype.android.webapi.builder.AuthParamsBuilder)1