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

Method newDeviceAuthLogin

src/device-login.ts:153–173  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151 }
152
153 public async newDeviceAuthLogin(): Promise<void> {
154 const { reqId, url } = getUniqueUrl();
155 const notificationTimeout = config.getMsUntilNextRun() - timeoutBufferMs;
156
157 logger.trace(
158 { notificationTimeout: `in ${(notificationTimeout / (60 * 1000)).toFixed(1)} minutes` },
159 'Awaiting login notification response',
160 );
161
162 // Wait on a promise to be resolved by the web redirect and login completing
163 await Promise.all([
164 promiseTimeout(
165 notificationTimeout,
166 new Promise((resolve, reject) => {
167 pendingRedirects.set(reqId, this.onLoginVisit(resolve, reject).bind(this));
168 }),
169 ),
170 await this.notify(NotificationReason.LOGIN, url),
171 ]);
172 pendingRedirects.delete(reqId);
173 }
174
175 private async notify(reason: NotificationReason, inUrl?: string): Promise<void> {
176 let url: string | undefined;

Callers 1

redeemAccountFunction · 0.95

Calls 4

notifyMethod · 0.95
getUniqueUrlFunction · 0.85
promiseTimeoutFunction · 0.85
getMsUntilNextRunMethod · 0.80

Tested by

no test coverage detected