(currentUrl: string, source: string)
| 46 | }); |
| 47 | |
| 48 | function _parseUrl(currentUrl: string, source: string) { |
| 49 | if (currentUrl.match(urlSuccessRegex)) { |
| 50 | console.log(`[oauth2] ${source}: Matched success redirect to "${currentUrl}" with ${urlSuccessRegex.toString()}`,); |
| 51 | finalUrl = currentUrl; |
| 52 | child.close(); |
| 53 | } else if (currentUrl.match(urlFailureRegex)) { |
| 54 | console.log(`[oauth2] ${source}: Matched error redirect to "${currentUrl}" with ${urlFailureRegex.toString()}`,); |
| 55 | finalUrl = currentUrl; |
| 56 | child.close(); |
| 57 | } else if (currentUrl === url) { |
| 58 | // It's the first one, so it's not a redirect |
| 59 | console.log(`[oauth2] ${source}: Loaded "${currentUrl}"`); |
| 60 | } else { |
| 61 | console.log(`[oauth2] ${source}: Ignoring URL "${currentUrl}". Didn't match ${urlSuccessRegex.toString()}`,); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | // Finish on close |
| 66 | child.on('close', () => { |
no test coverage detected