Skip to content

Commit

Permalink
Fix response handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pbulawa committed Nov 8, 2023
1 parent 645faeb commit faedff3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/authentication/auth_okta.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function auth_okta(password, region, account, clientType, clientVersion, httpCli
var tokenUrl;
await step1(authenticator, serviceName, account, username).then((response) =>
{
const responseData = JSON.parse(response['data']);
const responseData = response['data'];
const success = responseData['success'];
const errorCode = responseData['code'];
const errorMessage = responseData['message'];
Expand All @@ -78,7 +78,7 @@ function auth_okta(password, region, account, clientType, clientVersion, httpCli
var oneTimeToken;
await step3(tokenUrl, username, password).then((response) =>
{
var data = JSON.parse(response['data']);
var data = response['data'];

if (data['sessionToken']) {
oneTimeToken = data['sessionToken'];
Expand Down
16 changes: 8 additions & 8 deletions test/unit/authentication/authentication_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,20 +398,20 @@ describe('okta authentication', function ()
{
json =
{
data: JSON.stringify( {
data: {
success: true,
data: {
ssoUrl: mockssoUrl,
tokenUrl: mockTokenUrl
}
})
}
}
}
if (url === mockTokenUrl)
{
json =
{
data: JSON.stringify(mockCookieToken)
data: mockCookieToken
}
}
return json;
Expand Down Expand Up @@ -471,14 +471,14 @@ describe('okta authentication', function ()
{
json =
{
data: JSON.stringify({
data: {
success: true,
data:
{
ssoUrl: mockssoUrl,
tokenUrl: 'abcd'
}
})
}
}
}
return json;
Expand Down Expand Up @@ -514,21 +514,21 @@ describe('okta authentication', function ()
{
json =
{
data: JSON.stringify({
data: {
success: true,
data:
{
ssoUrl: mockssoUrl,
tokenUrl: mockTokenUrl
}
})
}
}
}
if (url === mockTokenUrl)
{
json =
{
data: JSON.stringify(mockCookieToken)
data: mockCookieToken
}
}
return json;
Expand Down

0 comments on commit faedff3

Please sign in to comment.