Skip to content

Commit

Permalink
fix: iss flow
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanharikr committed Dec 4, 2024
1 parent 97ec778 commit d99f9b7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
const params = new URLSearchParams(search || hash);
const iss = params.get('iss');
if (iss && iss?.startsWith('https://issuer.hello')) processIssuer(params);
if (iss && iss?.startsWith('https://issuer.hello')) await processIssuer(params);
if (params.has('id_token')) await processIdToken(params);
else if (params.has('code')) await processCode(params);
Expand Down Expand Up @@ -150,14 +150,21 @@
}
}
function processIssuer(params = {}) {
async function processIssuer(params = {}) {
try {
const iss = params.get('iss');
if (!iss) throw params;
const wallet = iss.replace('issuer', 'wallet');
const authorize = new URL('/authorize', wallet).href;
const loginHint = params.get('login_hint');
const domainHint = params.get('domain_hint');
// generate new pkce challenges for iss flow
const { nonce, code_verifier, code_challenge } = await generatePkce();
selectedProtocolParamsValues.nonce = nonce;
selectedProtocolParamsValues.code_verifier = code_verifier;
selectedProtocolParamsValues.code_challenge = code_challenge;
const url = makeAuthzUrl({
authzServer: authorize,
scopes: selectedScopes,
Expand Down

0 comments on commit d99f9b7

Please sign in to comment.