Static client attempt before DCR
This commit is contained in:
parent
37f634d651
commit
0b123acdac
1 changed files with 3 additions and 9 deletions
|
|
@ -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({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue