MCPcopy
hub / github.com/claabs/epicgames-freegames-node / refreshCookieLogin

Method refreshCookieLogin

src/puppet/login.ts:15–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13
14export default class PuppetLogin extends PuppetBase {
15 async refreshCookieLogin(): Promise<boolean> {
16 if (!userHasValidCookie(this.email, 'EPIC_SSO_RM')) return false;
17 const page = await this.setupPage();
18 try {
19 const url = generateLoginRedirect(STORE_CART_EN);
20 this.L.trace({ url }, 'Visiting login cart redirect');
21 await page.goto(url, {
22 waitUntil: 'networkidle0',
23 });
24 const cdpClient = await page.target().createCDPSession();
25 const currentUrlCookies = (await cdpClient.send('Network.getAllCookies')) as {
26 cookies: Protocol.Network.Cookie[];
27 };
28 if (currentUrlCookies.cookies.find((c) => c.name === 'EPIC_BEARER_TOKEN')) {
29 this.L.debug('Successfully refreshed cookie auth');
30 await this.teardownPage(page);
31 return true;
32 }
33 } catch (err) {
34 await this.handlePageError(err, page);
35 }
36 await this.teardownPage(page);
37 return false;
38 }
39
40 protected override async setupPage(): Promise<Page> {
41 this.L.debug('Setting auth from cookies');

Callers 1

redeemAccountFunction · 0.95

Calls 5

setupPageMethod · 0.95
userHasValidCookieFunction · 0.85
generateLoginRedirectFunction · 0.85
teardownPageMethod · 0.80
handlePageErrorMethod · 0.80

Tested by

no test coverage detected