EOSIO / ual-plainjs-renderer

library providers a Plain JS renderer around the Universal Authenticator Library
MIT License
11 stars 21 forks source link

AutoLogin not working with ng build --prod #85

Open raosaddam opened 3 years ago

raosaddam commented 3 years ago

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

Angular 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

abdulmanan7 commented 1 year ago

same issue with me i am usingual-plainjs-renderer in vuejs Dapp. if you got any solution please let me know Thanks