Skip to content

Commit 321f47b

Browse files
committed
Better support for tokens passed in URL fragment/hash.
1 parent c920ad6 commit 321f47b

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/website/index.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,22 @@ function parseLocationQuery() {
2525
const locSearch = queryString.parse(document.location.search.substr(1));
2626
const locHash = queryString.parse(document.location.hash.substr(1));
2727

28-
const token = locSearch.id_token ||
29-
locSearch.access_token ||
30-
locSearch.value ||
31-
locSearch.token;
32-
if(token) {
33-
setTokenEditorValue(token);
34-
35-
if(locSearch.publicKey) {
36-
publicKeyTextArea.value = locSearch.publicKey;
37-
}
28+
const keys = [ 'id_token', 'access_token', 'value', 'token'];
29+
for(const key of keys) {
30+
const token = locSearch[key] || locHash[key];
31+
32+
if(token) {
33+
setTokenEditorValue(token);
34+
35+
if(locSearch.publicKey) {
36+
publicKeyTextArea.value = locSearch.publicKey;
37+
}
3838

39-
debuggerSection.scrollIntoView(true);
40-
} else if(locHash.token) { // Legacy token passing method (as hash)
41-
setTokenEditorValue(locHash.token);
42-
}
39+
debuggerSection.scrollIntoView(true);
40+
41+
break;
42+
}
43+
}
4344
}
4445

4546
function pickEbookOrExtensionBanner() {

0 commit comments

Comments
 (0)