- Silently fallback to local login if OIDC config is incorrect

This commit is contained in:
adityachandelgit
2025-05-14 14:58:20 -06:00
committed by Aditya Chandel
parent 817b572c08
commit fa32e33ea5
2 changed files with 19 additions and 10 deletions
+17 -8
View File
@@ -21,9 +21,9 @@ export function initializeAuthFactory() {
scope: 'openid profile email offline_access',
redirectUri: window.location.origin + '/oauth2-callback',
responseType: 'code',
showDebugInformation: true,
requireHttps: false,
strictDiscoveryDocumentValidation: false,
showDebugInformation: false,
requireHttps: true,
strictDiscoveryDocumentValidation: true,
});
oauthService.events
@@ -36,11 +36,20 @@ export function initializeAuthFactory() {
authService.saveOidcTokens(accessToken, refreshToken ?? '');
});
oauthService.loadDiscoveryDocumentAndTryLogin().then(() => {
oauthService.setupAutomaticSilentRefresh();
websocketInitializer(authService);
resolve();
});
oauthService.loadDiscoveryDocumentAndTryLogin()
.then(() => {
oauthService.setupAutomaticSilentRefresh();
websocketInitializer(authService);
resolve();
})
.catch(err => {
console.error(
'OIDC initialization failed: Unable to complete OpenID Connect discovery or login. ' +
'This may be due to an incorrect issuer URL, client ID, or network issue. ' +
'Falling back to local login. Details:', err
);
resolve();
});
} else {
resolve();
}
@@ -77,7 +77,7 @@
pInputText
id="issuerUri"
[(ngModel)]="oidcProvider.issuerUri"
placeholder="e.g. https://auth.example.com/realms/myrealm"
placeholder="e.g. https://authentik.your-domain.com/application/o/booklore/"
class="w-full"/>
</div>
<div class="md:col-span-2">
@@ -86,7 +86,7 @@
pInputText
id="jwksUrl"
[(ngModel)]="oidcProvider.jwksUrl"
placeholder="e.g. https://auth.example.com/realms/myrealm/protocol/openid-connect/certs"
placeholder="e.g. https://authentik.your-domain.com/application/o/booklore/jwks/"
class="w-full"/>
</div>
<div class="md:col-span-2">