mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-08 00:16:09 +00:00
Use proper grant type to get new access token using refresh token
This commit is contained in:
parent
ae8e3ca904
commit
aa717b3e7b
@ -87,13 +87,16 @@ public class OAuth2GetRefreshedAccessTokenOperation extends RemoteOperation {
|
|||||||
mClientId,
|
mClientId,
|
||||||
mClientSecret
|
mClientSecret
|
||||||
);
|
);
|
||||||
|
|
||||||
OwnCloudCredentials oldCredentials = switchClientCredentials(oauthCredentials);
|
OwnCloudCredentials oldCredentials = switchClientCredentials(oauthCredentials);
|
||||||
|
|
||||||
client.executeMethod(postMethod);
|
client.executeMethod(postMethod);
|
||||||
|
|
||||||
switchClientCredentials(oldCredentials);
|
switchClientCredentials(oldCredentials);
|
||||||
|
|
||||||
String response = postMethod.getResponseBodyAsString();
|
String response = postMethod.getResponseBodyAsString();
|
||||||
Log_OC.d(TAG, "OAUTH2: raw response from POST TOKEN: " + response);
|
Log_OC.d(TAG, "OAUTH2: raw response from POST TOKEN: " + response);
|
||||||
|
|
||||||
if (response != null && response.length() > 0) {
|
if (response != null && response.length() > 0) {
|
||||||
JSONObject tokenJson = new JSONObject(response);
|
JSONObject tokenJson = new JSONObject(response);
|
||||||
parseNewAccessTokenResult(tokenJson);
|
parseNewAccessTokenResult(tokenJson);
|
||||||
|
@ -28,6 +28,7 @@ package com.owncloud.android.lib.common.network.authentication.oauth;
|
|||||||
|
|
||||||
public enum OAuth2GrantType {
|
public enum OAuth2GrantType {
|
||||||
AUTHORIZATION_CODE("authorization_code"),
|
AUTHORIZATION_CODE("authorization_code"),
|
||||||
|
REFRESH_TOKEN("refresh_token"),
|
||||||
IMPLICIT("implicit"),
|
IMPLICIT("implicit"),
|
||||||
PASSWORD("password"),
|
PASSWORD("password"),
|
||||||
CLIENT_CREDENTIAL("client_credentials");
|
CLIENT_CREDENTIAL("client_credentials");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user