diff --git a/src/com/owncloud/android/lib/common/network/authentication/oauth/OAuth2GetRefreshedAccessTokenOperation.java b/src/com/owncloud/android/lib/common/network/authentication/oauth/OAuth2GetRefreshedAccessTokenOperation.java index c1257b82..ec95d628 100644 --- a/src/com/owncloud/android/lib/common/network/authentication/oauth/OAuth2GetRefreshedAccessTokenOperation.java +++ b/src/com/owncloud/android/lib/common/network/authentication/oauth/OAuth2GetRefreshedAccessTokenOperation.java @@ -87,13 +87,16 @@ public class OAuth2GetRefreshedAccessTokenOperation extends RemoteOperation { mClientId, mClientSecret ); + OwnCloudCredentials oldCredentials = switchClientCredentials(oauthCredentials); client.executeMethod(postMethod); + switchClientCredentials(oldCredentials); String response = postMethod.getResponseBodyAsString(); Log_OC.d(TAG, "OAUTH2: raw response from POST TOKEN: " + response); + if (response != null && response.length() > 0) { JSONObject tokenJson = new JSONObject(response); parseNewAccessTokenResult(tokenJson); diff --git a/src/com/owncloud/android/lib/common/network/authentication/oauth/OAuth2GrantType.java b/src/com/owncloud/android/lib/common/network/authentication/oauth/OAuth2GrantType.java index 26c53dba..fdf98bcf 100644 --- a/src/com/owncloud/android/lib/common/network/authentication/oauth/OAuth2GrantType.java +++ b/src/com/owncloud/android/lib/common/network/authentication/oauth/OAuth2GrantType.java @@ -28,6 +28,7 @@ package com.owncloud.android.lib.common.network.authentication.oauth; public enum OAuth2GrantType { AUTHORIZATION_CODE("authorization_code"), + REFRESH_TOKEN("refresh_token"), IMPLICIT("implicit"), PASSWORD("password"), CLIENT_CREDENTIAL("client_credentials");