Skip to content

Commit

Permalink
Merge branch 'main' into iyk/demo-mobile-landing-page
Browse files Browse the repository at this point in the history
  • Loading branch information
iykazrji authored Sep 30, 2024
2 parents 870ce0f + 2492e47 commit 0276517
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion account-kit/signer/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ export class AlchemySignerWebClient extends BaseSignerClient<ExportWalletParams>
let scope: string;
let claims: string | undefined;
if (providedScope) {
scope = providedScope;
scope = addOpenIdIfAbsent(providedScope);
claims = providedClaims;
} else {
if (isCustomProvider) {
Expand Down Expand Up @@ -670,6 +670,17 @@ function resolveRelativeUrl(url: string): string {
return a.href;
}

/**
* "openid" is a required scope in the OIDC protocol. Insert it if the user
* forgot.
*
* @param {string} scope scope param which may be missing "openid"
* @returns {string} scope which most definitely contains "openid"
*/
function addOpenIdIfAbsent(scope: string): string {
return scope.match(/\bopenid\b/) ? scope : `openid ${scope}`;
}

/**
* This error is thrown when the OAuth flow is cancelled because the auth popup
* window was closed.
Expand Down

0 comments on commit 0276517

Please sign in to comment.