Udhayakumar G
Am a seasoned Full stack java developer, have close to 11 years experience in developing software systems (both frontend and backend). Love to share my knowledge with community. Happy coding!
Hello, Am Udhay (OO-dhy)
A utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 that can be composed to build any design, directly in your markup.
import { domain, clientId } from '../../auth_config.json';
export const environment = {
production: false,
auth: {
domain,
clientId,
redirectUri: window.location.origin,
},
};
Register Auth0 Module in app,module.ts as shown below:
import { AuthModule } from '@auth0/auth0-angular';
import { environment as env } from '../environments/environment';
.
@NgModule({
declarations: [...],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
.
.
// add and initialize AuthModule
AuthModule.forRoot({
...env.auth,
}),
],
.
Add Auth0 "AuthGuard" to canActivate Routes property. It handles Login and redirect back User to requested path.
.
.
import { AuthGuard } from '@auth0/auth0-angular';
const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
.
.
.
{
path: 'pokemon/:id',
loadChildren: () =>
import('./pokemon-stats/pokemon-stats.module').then(
(m) => m.PokemonStatsModule
),
canActivate: [AuthGuard],
},
];
.
.
Let's explore Auth0 - Identity providers and Multi Factor Authentication
Code -
Demo -
Checkout my previous
By Udhayakumar G
This is my recent talk for Angular Online Meetup on "Let's create an Angular Storybook! 🎨". Reach me @askudhay on Twitter. Happy learning! Thanks.
Am a seasoned Full stack java developer, have close to 11 years experience in developing software systems (both frontend and backend). Love to share my knowledge with community. Happy coding!