If I perform a call to getIsAuthorized() immediately after a successul login, it will return false.
Sleeping for a second solves the problem, but this is only a workaround.
I think, call to getIsAuthorized() and authorize() have to be synced somehow.
If you are using a call to load_using_stsServer in your app initialization, then you might be experiencing the same issue as I did. The return type of load_using_stsServer is void, but it actually returns a promise that resolves with configuration retrieved from sts server. See, https://github.com/damienbod/angular-auth-oidc-client/blob/2044c48ddbecb447cb8339e34c649181169c926c/projects/angular-auth-oidc-client/src/lib/services/oidc.security.config.service.ts#L38
This creates a race condition, because we cannot wait for that call to finish before moving onto initializing the angular app. I worked around this issue in my app by casting the oidcConfigService to any and casting the oidcConfigService.load_using_stsServer to Promise<any>. Angular awaits any promises returned in the app initializers.
fixed in version 11, thanks for reporting
Most helpful comment
If you are using a call to
load_using_stsServerin your app initialization, then you might be experiencing the same issue as I did. The return type ofload_using_stsServerisvoid, but it actually returns a promise that resolves with configuration retrieved from sts server. See, https://github.com/damienbod/angular-auth-oidc-client/blob/2044c48ddbecb447cb8339e34c649181169c926c/projects/angular-auth-oidc-client/src/lib/services/oidc.security.config.service.ts#L38This creates a race condition, because we cannot wait for that call to finish before moving onto initializing the angular app. I worked around this issue in my app by casting the
oidcConfigServicetoanyand casting theoidcConfigService.load_using_stsServertoPromise<any>. Angular awaits any promises returned in the app initializers.