I'm trying to implement Anchor and Wax login with UAL in an angular app. Everything works fine except when I refresh my page UAL is unable to find the logged in user from session. This is happening because 'ual-session-authenticator' is not saved. The value for 'ual-session-authenticator' in localStorage is always null because it is saved by localStorage.setItem(UALJs.SESSION_AUTHENTICATOR_KEY, authenticator.constructor.name);
in UALJs . And on page refresh when it tries to find the session authenticator it couldnt because it also uses
const sessionAuthenticator = authenticators.find((authenticator) => authenticator.constructor.name === authenticatorName);
This only happens with ng serve --prod --sourceMap and ng build --prod. Dev build ng serve works fine. Angular uglify class names for prod builds.
A better way is to use instanceof instead of constructor.name
I'm trying to implement Anchor and Wax login with UAL in an angular app. Everything works fine except when I refresh my page UAL is unable to find the logged in user from session. This is happening because 'ual-session-authenticator' is not saved. The value for 'ual-session-authenticator' in localStorage is always null because it is saved by
localStorage.setItem(UALJs.SESSION_AUTHENTICATOR_KEY, authenticator.constructor.name);
in UALJs . And on page refresh when it tries to find the session authenticator it couldnt because it also usesconst sessionAuthenticator = authenticators.find((authenticator) => authenticator.constructor.name === authenticatorName);
This only happens with
ng serve --prod --sourceMap
andng build --prod
. Dev buildng serve
works fine. Angular uglify class names for prod builds. A better way is to use instanceof instead of constructor.nameAngular CLI: 11.0.5 Node: 14.15.0 OS: win32 x64
Angular: 11.0.5 ... animations, cli, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router Ivy Workspace: Yes
Package Version
@angular-devkit/architect 0.1100.5 @angular-devkit/build-angular 0.1100.5 @angular-devkit/core 11.0.5 @angular-devkit/schematics 11.0.5 @schematics/angular 11.0.5 @schematics/update 0.1100.5 rxjs 6.6.3 typescript 4.0.3