55 * @author Christian Schabesberger
66 * @author David González Verdugo
77 * @author Juan Carlos Garrote Gascón
8+ * @author Jorge Aguado Recio
89 *
910 * Copyright (C) 2012 Bartek Przybylski
10- * Copyright (C) 2024 ownCloud GmbH.
11+ * Copyright (C) 2025 ownCloud GmbH.
1112 *
1213 * This program is free software: you can redistribute it and/or modify
1314 * it under the terms of the GNU General Public License version 2,
@@ -346,13 +347,23 @@ private String refreshToken(
346347 String clientIdForRequest = null ;
347348 String clientSecretForRequest = null ;
348349
350+ boolean isKiteworksServer = Boolean .parseBoolean (accountManager .getUserData (account , AccountUtils .Constants .KEY_IS_KITEWORKS_SERVER ));
351+
349352 if (clientId == null ) {
350353 Timber .d ("Client Id not stored. Let's use the hardcoded one" );
351- clientId = mContext .getString (R .string .oauth2_client_id );
354+ if (isKiteworksServer ) {
355+ clientId = mContext .getString (R .string .kiteworks_client_id );
356+ } else {
357+ clientId = mContext .getString (R .string .oauth2_client_id );
358+ }
352359 }
353360 if (clientSecret == null ) {
354361 Timber .d ("Client Secret not stored. Let's use the hardcoded one" );
355- clientSecret = mContext .getString (R .string .oauth2_client_secret );
362+ if (isKiteworksServer ) {
363+ clientSecret = mContext .getString (R .string .kiteworks_client_secret );
364+ } else {
365+ clientSecret = mContext .getString (R .string .oauth2_client_secret );
366+ }
356367 }
357368
358369 if (oidcServerConfigurationUseCaseResult .isSuccess ()) {
@@ -376,7 +387,12 @@ private String refreshToken(
376387
377388 String clientAuth = OAuthUtils .Companion .getClientAuth (clientSecret , clientId );
378389
379- String scope = mContext .getResources ().getString (R .string .oauth2_openid_scope );
390+ String scope ;
391+ if (isKiteworksServer ) {
392+ scope = mContext .getResources ().getString (R .string .kiteworks_openid_scope );
393+ } else {
394+ scope = mContext .getResources ().getString (R .string .oauth2_openid_scope );
395+ }
380396
381397 TokenRequest oauthTokenRequest = new TokenRequest .RefreshToken (
382398 baseUrl ,
0 commit comments