I'm submitting this issue for the package(s):
I'm submitting a:
Current behavior
Using the OktaAuthService causes Angular apps to never become stable if you access the app after you're logged in. Apps need to get to a stable state in order to use service workers and to be used as a PWA. I believe this is problem with the line this.oktaAuth = new OktaAuth(buildConfigObject(auth)); in the constructor of OktaAuthService.
There's more information on what causes apps to be stable or not stable at the Angular service worker page at https://angular.io/guide/service-worker-communications. Excerpt from there:
In order to avoid negatively affecting the initial rendering, ServiceWorkerModule will by default wait for the app to stabilize, before registering the ServiceWorker script. Constantly polling for updates, e.g. with interval(), will prevent the app from stabilizing and the ServiceWorker script will never be registered with the browser.
You can avoid that by waiting for the app to stabilize first, before starting to poll for updates (as shown in the example above).
Note that this is true for any kind of polling done by your application. Check the isStable documentation for more information.
Expected behavior
The app should become stable before Okta does its thing.
Minimal reproduction of the problem with instructions
Using the sample Angular app, import ApplicationRef and add this to your app.component.ts constructor:
appRef.isStable.subscribe(isStable => console.log(isStable));
Once you log into the Angular app, click refresh and you'll see it never gets stable.
Extra information about the use case/user story you are trying to implement
Service workers and PWAs are not doable using this Okta library.
Environment
- Package Version: okta-angular 1.2
- Browser: Chrome
- OS: Mac
- Node version (
node -v): 10.12.0
- Other:
I'm submitting this issue for the package(s):
I'm submitting a:
Current behavior
Using the OktaAuthService causes Angular apps to never become stable if you access the app after you're logged in. Apps need to get to a stable state in order to use service workers and to be used as a PWA. I believe this is problem with the line
this.oktaAuth = new OktaAuth(buildConfigObject(auth));in the constructor of OktaAuthService.There's more information on what causes apps to be stable or not stable at the Angular service worker page at https://angular.io/guide/service-worker-communications. Excerpt from there:
Expected behavior
The app should become stable before Okta does its thing.
Minimal reproduction of the problem with instructions
Using the sample Angular app, import ApplicationRef and add this to your app.component.ts constructor:
appRef.isStable.subscribe(isStable => console.log(isStable));Once you log into the Angular app, click refresh and you'll see it never gets stable.
Extra information about the use case/user story you are trying to implement
Service workers and PWAs are not doable using this Okta library.
Environment
node -v): 10.12.0