1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Use proper grant type to get new access token using refresh token

This commit is contained in:
davigonz 2017-07-31 10:47:20 +02:00
parent ae8e3ca904
commit aa717b3e7b
2 changed files with 4 additions and 0 deletions

View File

@ -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);

View File

@ -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");