Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App does not load if STS has an issue, CORS for Example #717

Closed
paulstelzer opened this issue May 8, 2020 · 6 comments
Closed

App does not load if STS has an issue, CORS for Example #717

paulstelzer opened this issue May 8, 2020 · 6 comments

Comments

@paulstelzer
Copy link

Describe the bug
If the sts server has no cors enabled, the application will not start

To Reproduce
Steps to reproduce the behavior:

  1. Use a server (stsServer) who has no cors enabled
  2. If you add
    OidcConfigService,
    {
      provide: APP_INITIALIZER,
      useFactory: configureAuth,
      deps: [OidcConfigService],
      multi: true,
    },

to your app-module.ts providers section, you will see that the application will not start anymore.

Expected behavior
The application should start anyway.

Desktop (please complete the following information):
All

Smartphone (please complete the following information):
All

@damienbod
Copy link
Owner

Hi @paulstelzer Just wondering if this is good or not. Why should the APP start? If the STS is setup incorrectly and you can not authenticate from the Angular APP, then there is no point in having the authn in the Angular APP.

Greetings Damien

@FabianGosebrink
Copy link
Collaborator

Have you tried to catch the error in the init and return a resolved (but empty) promise instead?

@damienbod
Copy link
Owner

damienbod commented May 8, 2020

If CORS is broken on your STS, then you have a DevOps problem maybe, or the system never ran. This is one thing I don't understand in catching. But yes, maybe the app should be able to recover from this.

@FabianGosebrink FabianGosebrink changed the title Cors issue App does not load if STS has an issue, CORS for Example May 8, 2020
@paulstelzer
Copy link
Author

paulstelzer commented May 8, 2020

Cors is enabled now, I only found the issue and want to let you know. I think it's better to have an application that is running than having a white page :)

@FabianGosebrink
Copy link
Collaborator

Totally. Thanks for mentioning this. Glad your issue is fixed. Maybe we will tackle this in future versions. But this would be a breaking change again. We have to draw this first, try it out and maybe bring that up in future versions. Thanks for using the lib 🙃

@FabianGosebrink
Copy link
Collaborator

Hey @paulstelzer , just wanted to let you know that we just merged a PR which gives you the possibility to lazy load the config and so move the error - if there is one at your sts - to the moment when the user clicks login.

https://github.com/damienbod/angular-auth-oidc-client/pull/724/files#diff-e71cfa1c040ef2eea5de14baab837af9

describes the feature. If you set the eagerLoadAuthWellKnownEndpoints to false your app will start right away and do the call when you call authenticate. Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants