Skip to content

Commit

Permalink
Re-add client redirect request
Browse files Browse the repository at this point in the history
  • Loading branch information
claabs committed Dec 18, 2020
1 parent c557262 commit 9eae9f2
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
MFA_LOGIN_ENDPOINT,
SET_SID_ENDPOINT,
AUTHENTICATE_ENDPOINT,
CLIENT_REDIRECT_ENDPOINT,
} from './common/constants';
import { config } from './common/config';

Expand Down Expand Up @@ -152,21 +153,25 @@ export default class Login {

async refreshAndSid(error: boolean): Promise<boolean> {
this.L.debug('Refreshing login session');
await this.getStoreToken();

await this.getReputation();
// const csrfToken = await this.getCsrf();

const clientRedirectSearchParams = { redirectUrl: STORE_HOMEPAGE };
this.L.trace(
{ params: clientRedirectSearchParams, url: CLIENT_REDIRECT_ENDPOINT },
'Client redirect request'
);
const clientRedirectResp = await this.request.get(CLIENT_REDIRECT_ENDPOINT, {
searchParams: clientRedirectSearchParams,
});
this.L.trace({ resp: clientRedirectResp.body }, 'Client redirect response');

this.L.trace({ url: AUTHENTICATE_ENDPOINT }, 'Authenticate request');
const authenticateResp = await this.request.get(AUTHENTICATE_ENDPOINT);
this.L.trace({ resp: authenticateResp.body }, 'Authenticate response');

// const clientRedirectSearchParams = { redirectUrl: STORE_HOMEPAGE };
// this.L.trace(
// { params: clientRedirectSearchParams, url: CLIENT_REDIRECT_ENDPOINT },
// 'Client redirect request'
// );
// const clientRedirectResp = await this.request.get(CLIENT_REDIRECT_ENDPOINT, {
// searchParams: clientRedirectSearchParams,
// });
// this.L.trace({ resp: clientRedirectResp.body }, 'Client redirect response');

const redirectSearchParams = { clientId: EPIC_CLIENT_ID, redirectUrl: STORE_HOMEPAGE };
this.L.trace({ params: redirectSearchParams, url: REDIRECT_ENDPOINT }, 'Redirect request');
const redirectResp = await this.request.get<RedirectResponse>(REDIRECT_ENDPOINT, {
Expand Down

0 comments on commit 9eae9f2

Please sign in to comment.