mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
CE-2260: added utility method for getting oath access key which will handle variants properly
This commit is contained in:
@ -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. //
|
// 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();
|
Serializable variantId = getVariantId();
|
||||||
accessTokenKey = accessTokenKey + ":" + variantId;
|
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. //
|
// 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)
|
if(!caughtAnOAuthExpiredToken)
|
||||||
{
|
{
|
||||||
LOG.info("OAuth Expired token for [" + table.getName() + "] - retrying");
|
LOG.info("OAuth Expired token for [" + table.getName() + "] - retrying");
|
||||||
|
// String accessTokenKey = getOAuth2AccessTokenKey();
|
||||||
|
// backendMetaData.withCustomValue(accessTokenKey, null);
|
||||||
backendMetaData.withCustomValue("accessToken", null);
|
backendMetaData.withCustomValue("accessToken", null);
|
||||||
caughtAnOAuthExpiredToken = true;
|
caughtAnOAuthExpiredToken = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user