use of com.mxt.anitrend.model.entity.base.AuthBase in project anitrend-app by AniTrend.
the class WebTokenRequest method getToken.
/**
* Request a new access token using access code for authenticated content,
* and replace the current token with the new one from the server after authentication
*/
public static synchronized boolean getToken(Context context, String code) throws ExecutionException, InterruptedException {
WebToken authenticatedToken = new AuthenticationCodeAsync().execute(code).get();
if (authenticatedToken != null) {
DatabaseHelper databaseHelper = new DatabaseHelper(context);
databaseHelper.saveWebToken(authenticatedToken);
databaseHelper.saveAuthCode(new AuthBase(code, authenticatedToken.getRefresh_token()));
createNewTokenReference(authenticatedToken);
return true;
}
return false;
}
Aggregations