Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async handleAuth (): Promise {
const query = parseQuery(window.location.search)
if (query.code) {
if (query.state !== this.state) {
return null
}
const code = query.code
delete query.code
delete query.state
const replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash
window.history.replaceState(null, '', replaceURL)
const accessToken = await this.getAccessToken({ code })
return accessToken
}
return null
}
async handleAuth (): Promise {
const query = parseQuery(window.location.search)
if (query.code) {
if (query.state !== this.state) {
return null
}
const code = query.code
delete query.code
delete query.state
const replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash
window.history.replaceState(null, '', replaceURL)
const accessToken = await this.getAccessToken({ code })
return accessToken
}
return null
}
async handleAuth (): Promise {
const hash = parseQuery(window.location.hash.slice(1))
if (!hash.access_token || hash.state !== this.state) {
return null
}
const accessToken = hash.access_token
delete hash.access_token
delete hash.token_type
delete hash.expires_in
delete hash.state
const hashString = buildQuery(hash)
const newHash = hashString ? `#${hashString}` : ''
const replaceURL = `${getCleanURL(window.location.href)}${window.location.search}${newHash}`
window.history.replaceState(null, '', replaceURL)
return accessToken
}
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
query = parseQuery(window.location.search);
if (!query.code) return [3 /*break*/, 2];
if (query.state !== this.state) {
return [2 /*return*/, null];
}
code = query.code;
delete query.code;
delete query.state;
replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash;
window.history.replaceState(null, '', replaceURL);
return [4 /*yield*/, this.getAccessToken({ code: code })];
case 1:
accessToken = _a.sent();
return [2 /*return*/, accessToken];
case 2: return [2 /*return*/, null];
}
});
async handleAuth (): Promise {
const query = parseQuery(window.location.search)
if (query.code) {
const code = query.code
delete query.code
const replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash
window.history.replaceState(null, '', replaceURL)
const accessToken = await this.getAccessToken({ code })
return accessToken
}
return null
}
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
query = parseQuery(window.location.search);
if (!query.code) return [3 /*break*/, 2];
if (query.state !== this.state) {
return [2 /*return*/, null];
}
code = query.code;
delete query.code;
delete query.state;
replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash;
window.history.replaceState(null, '', replaceURL);
return [4 /*yield*/, this.getAccessToken({ code: code })];
case 1:
accessToken = _a.sent();
return [2 /*return*/, accessToken];
case 2: return [2 /*return*/, null];
}
});
async handleAuth (): Promise {
const query = parseQuery(window.location.search)
if (query.code) {
if (query.state !== this.state) {
return null
}
const code = query.code
delete query.code
delete query.state
const replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash
window.history.replaceState(null, '', replaceURL)
const accessToken = await this.getAccessToken({ code })
return accessToken
}
return null
}
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
query = parseQuery(window.location.search);
if (!query.code) return [3 /*break*/, 2];
code = query.code;
delete query.code;
replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash;
window.history.replaceState(null, '', replaceURL);
return [4 /*yield*/, this.getAccessToken({ code: code })];
case 1:
accessToken = _a.sent();
return [2 /*return*/, accessToken];
case 2: return [2 /*return*/, null];
}
});
});
async handleAuth (): Promise {
const hash = parseQuery(window.location.hash.slice(1))
if (!hash.access_token || hash.state !== this.state) {
return null
}
const accessToken = hash.access_token
delete hash.access_token
delete hash.token_type
delete hash.expires_in
delete hash.state
delete hash.scopes
const hashString = buildQuery(hash)
const newHash = hashString ? `#${hashString}` : ''
const replaceURL = `${getCleanURL(window.location.href)}${window.location.search}${newHash}`
window.history.replaceState(null, '', replaceURL)
return accessToken
}
async handleAuth (): Promise {
const query = parseQuery(window.location.search)
if (query.code) {
if (query.state !== this.state) {
return null
}
const code = query.code
delete query.code
delete query.state
const replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash
window.history.replaceState(null, '', replaceURL)
const accessToken = await this.getAccessToken({ code })
return accessToken
}
return null
}