I’m trying to use the auth0-angular library with Angular 10 to allow a specific set of google users to log in to my site.
I found a guide on creating a Whitelist rule, which works okay, but I have a couple questions:
Is there a way I can feed the list of valid emails into this rule from my app using config or anything? Right now, I just have a hard-coded list of strings in the rules, which adds an unwanted maintenance cost.
The example throws an UnauthorizedError() in the rule, which doesn’t result in displaying any error page in my app. It just redirects back to the callback with isLoggedIn as false. I tried using the Observable returned by loginWithRedirect() to catch the error, but this error is never thrown.
If you’re using the Angular Quick Start, you can edit the ngOnInit function in the src/app/components/nav-bar/nav-bar.component.ts file to log the error:
Yes, Rules have access to the Context object which contains the clientMetadata property as well as other information about your app. You can store key/value pairs of data in your application’s client metadata by opening up the advanced settings in the application settings in the dashboard.