()
| 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; |
no test coverage detected