1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-06 04:00:05 +00:00

chore(*): refactor common functionality into JobExecutor, handle all auth-related scenarios

This commit is contained in:
Krishna Acondy
2021-02-02 08:18:48 +00:00
parent 2ea49a425f
commit 03b5e1d824
11 changed files with 307 additions and 375 deletions

View File

@@ -18,7 +18,6 @@ import { ContextManager } from './ContextManager'
import { timestampToYYYYMMDDHHMMSS } from '@sasjs/utils/time'
import { Logger, LogLevel } from '@sasjs/utils/logger'
import { isAuthorizeFormRequired } from './auth/isAuthorizeFormRequired'
import { parseAndSubmitAuthorizeForm } from './auth'
import { RequestClient } from './request/RequestClient'
import { NotFoundError } from './types/NotFoundError'
@@ -632,10 +631,7 @@ export class SASViyaApiClient {
.then(async (response) => {
let code = ''
if (isAuthorizeFormRequired(response)) {
const formResponse: any = await parseAndSubmitAuthorizeForm(
response,
this.serverUrl
)
const formResponse: any = await this.requestClient.authorize(response)
const responseBody = formResponse
.split('<body>')[1]