From b2c8c075fdf050bd2d8b6fb52b2656e71eef1536 Mon Sep 17 00:00:00 2001 From: Tim Chamberlain Date: Fri, 21 Feb 2025 12:09:36 -0600 Subject: [PATCH] CE-2260: added utility method for getting oath access key which will handle variants properly --- .../module/api/actions/BaseAPIActionUtil.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/qqq-backend-module-api/src/main/java/com/kingsrook/qqq/backend/module/api/actions/BaseAPIActionUtil.java b/qqq-backend-module-api/src/main/java/com/kingsrook/qqq/backend/module/api/actions/BaseAPIActionUtil.java index 209285e0..6a2b227a 100644 --- a/qqq-backend-module-api/src/main/java/com/kingsrook/qqq/backend/module/api/actions/BaseAPIActionUtil.java +++ b/qqq-backend-module-api/src/main/java/com/kingsrook/qqq/backend/module/api/actions/BaseAPIActionUtil.java @@ -845,7 +845,7 @@ public class BaseAPIActionUtil /******************************************************************************* ** *******************************************************************************/ - public String getOAuth2Token() throws OAuthCredentialsException, QException + String getOAuth2AccessTokenKey() throws QException { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // define the key that will be used in the backend's customValues map, to stash the access token. // @@ -857,6 +857,17 @@ public class BaseAPIActionUtil Serializable variantId = getVariantId(); accessTokenKey = accessTokenKey + ":" + variantId; } + return (accessTokenKey); + } + + + + /******************************************************************************* + ** + *******************************************************************************/ + public String getOAuth2Token() throws QException + { + String accessTokenKey = getOAuth2AccessTokenKey(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // check for the access token in the backend meta data. if it's not there, then issue a request for a token. // @@ -1245,6 +1256,8 @@ public class BaseAPIActionUtil if(!caughtAnOAuthExpiredToken) { LOG.info("OAuth Expired token for [" + table.getName() + "] - retrying"); + // String accessTokenKey = getOAuth2AccessTokenKey(); + // backendMetaData.withCustomValue(accessTokenKey, null); backendMetaData.withCustomValue("accessToken", null); caughtAnOAuthExpiredToken = true; }