@smythos/sre 1.5.52 → 1.5.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smythos/sre",
3
- "version": "1.5.52",
3
+ "version": "1.5.53",
4
4
  "description": "Smyth Runtime Environment",
5
5
  "author": "Alaa-eddine KADDOURI",
6
6
  "license": "MIT",
@@ -114,7 +114,8 @@ export class APICall extends Component {
114
114
  let Headers: any = {};
115
115
  let _error: any = undefined;
116
116
  try {
117
- if (config?.data?.oauth_con_id !== '' && config?.data?.oauth_con_id !== 'None') {
117
+ // To support both old and new OAuth configuration, we check for both oauth_con_id and oauthService.
118
+ if ((config?.data?.oauth_con_id !== '' && config?.data?.oauth_con_id !== 'None') || (config?.data?.oauthService !== '' && config.data.oauthService !== 'None')) {
118
119
  const additionalParams = extractAdditionalParamsForOAuth1(reqConfig);
119
120
  const oauthHeaders = await generateOAuthHeaders(agent, config, reqConfig, logger, additionalParams);
120
121
  //reqConfig.headers = { ...reqConfig.headers, ...oauthHeaders };
@@ -176,7 +176,8 @@ export const buildOAuth1Header = (url, method, oauth1Credentials, additionalPara
176
176
  export const retrieveOAuthTokens = async (agent, config) => {
177
177
  let tokenKey: any = null;
178
178
  try {
179
- tokenKey = config?.data?.oauth_con_id;
179
+ // To support both old and new OAuth configuration, we check for both oauth_con_id and config.id (component id)
180
+ tokenKey = config?.data?.oauth_con_id || `OAUTH_${config?.id}_TOKENS`;
180
181
 
181
182
  try {
182
183
  const result: any = await managedVault.user(AccessCandidate.agent(agent.id)).get(tokenKey);
@@ -423,7 +424,7 @@ async function getClientCredentialToken(tokensData, logger, keyId, oauthTokens,
423
424
  if (!updatedData.team) updatedData.team = agent.teamId;
424
425
  if (!updatedData.oauth_info) {
425
426
  updatedData.oauth_info = {
426
- oauth_keys_prefix: `OAUTH_${config?.data?.oauth_con_id?.split('_')[1]}`,
427
+ oauth_keys_prefix: `OAUTH_${config?.data?.oauth_con_id?.split('_')[1] || config?.id}`,
427
428
  service: 'oauth2_client_credentials',
428
429
  tokenURL,
429
430
  clientID,