Skip to content

Commit

Permalink
Don't throw error if no OIDC config endpoint is found
Browse files Browse the repository at this point in the history
  • Loading branch information
srosset81 committed Dec 19, 2023
1 parent bbbeec9 commit 55db267
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
11 changes: 8 additions & 3 deletions src/frontend/packages/auth-provider/dist/index.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/frontend/packages/auth-provider/dist/index.cjs.js.map

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions src/frontend/packages/auth-provider/dist/index.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/frontend/packages/auth-provider/dist/index.es.js.map

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/frontend/packages/auth-provider/src/authProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,17 @@ const authProvider = ({
// Delete token but also any other value in local storage
localStorage.clear();

const { status, json: oidcConfig } = await dataProvider.fetch(
urlJoin(authServerUrl, '.well-known/openid-configuration')
);
let result = {};

try {
result = await dataProvider.fetch(urlJoin(authServerUrl, '.well-known/openid-configuration'));
} catch (e) {
// Do nothing if it fails
}

if (status === 200) {
if (result.status === 200 && result.json) {
// Redirect to OIDC endpoint if it exists
window.location.href = oidcConfig.end_session_endpoint;
window.location.href = result.json.end_session_endpoint;
} else {
// Reload to ensure the dataServer config is reset
window.location.reload();
Expand Down

0 comments on commit 55db267

Please sign in to comment.