Static client attempt before DCR

This commit is contained in:
2underscores 2025-08-12 09:20:28 +10:00
commit 0b123acdac

View file

@ -88,20 +88,14 @@ export const oauthTransitions: Record<OAuthStep, StateTransition> = {
clientMetadata.scope = scopesSupported.join(" "); clientMetadata.scope = scopesSupported.join(" ");
} }
// Try DCR first, with static client as fallback // Try Static client first, with DCR as fallback
let fullInformation; let fullInformation = await context.provider.clientInformation();
try { if (!fullInformation) {
fullInformation = await registerClient(context.serverUrl, { fullInformation = await registerClient(context.serverUrl, {
metadata, metadata,
clientMetadata, clientMetadata,
}); });
context.provider.saveClientInformation(fullInformation); context.provider.saveClientInformation(fullInformation);
} catch (dcrError) {
// DCR failed, fallback to preregistered client
fullInformation = await context.provider.clientInformation();
if (!fullInformation) {
throw dcrError;
}
} }
context.updateState({ context.updateState({