Skip to content

Commit 653b7ad

Browse files
Merge pull request #105 from SmythOS/dev
Dev Merge
2 parents 82f30b3 + bbf6ca6 commit 653b7ad

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@smythos/sre",
3-
"version": "1.5.52",
3+
"version": "1.5.53",
44
"description": "Smyth Runtime Environment",
55
"author": "Alaa-eddine KADDOURI",
66
"license": "MIT",

packages/core/src/Components/APICall/APICall.class.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ export class APICall extends Component {
114114
let Headers: any = {};
115115
let _error: any = undefined;
116116
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')) {
118119
const additionalParams = extractAdditionalParamsForOAuth1(reqConfig);
119120
const oauthHeaders = await generateOAuthHeaders(agent, config, reqConfig, logger, additionalParams);
120121
//reqConfig.headers = { ...reqConfig.headers, ...oauthHeaders };

packages/core/src/Components/APICall/OAuth.helper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ export const buildOAuth1Header = (url, method, oauth1Credentials, additionalPara
176176
export const retrieveOAuthTokens = async (agent, config) => {
177177
let tokenKey: any = null;
178178
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`;
180181

181182
try {
182183
const result: any = await managedVault.user(AccessCandidate.agent(agent.id)).get(tokenKey);
@@ -423,7 +424,7 @@ async function getClientCredentialToken(tokensData, logger, keyId, oauthTokens,
423424
if (!updatedData.team) updatedData.team = agent.teamId;
424425
if (!updatedData.oauth_info) {
425426
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}`,
427428
service: 'oauth2_client_credentials',
428429
tokenURL,
429430
clientID,

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@smythos/sdk",
3-
"version": "1.0.47",
3+
"version": "1.0.48",
44
"description": "SRE SDK",
55
"keywords": [
66
"smythos",

0 commit comments

Comments
 (0)