Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Pages/Home/JwtDecoder/JwtDecoder.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@
let jwksUrl = jwksUrlField.val().trim();
if ((!jwksUrl || isPristine) && payload && payload.iss) {
// If no JWKs URL is provided (or previously set from a different token's issuer), use the issuer from the payload.
jwksUrl = payload.iss;
jwksUrl = appendDiscoveryPath(payload.iss);
jwksUrlField.val(jwksUrl);
}

Expand Down Expand Up @@ -769,6 +769,10 @@
}
}

function appendDiscoveryPath(url) {
return url + (url.slice(-1) === '/' ? '' : '/') + '.well-known/openid-configuration';
}

async function fetchJwks(url) {
const response = await fetch(url);
if (!response.ok) {
Expand All @@ -783,7 +787,7 @@
}
else {
// retry with a discovery document
return await fetchJwks(url + (url.slice(url.length - 1) === '/' ? '' : '/') + '.well-known/openid-configuration');
return await fetchJwks(appendDiscoveryPath(url));
}
}

Expand Down