Custom server auth provider
Now that you understand the auth implementation in our server, we can implement a custom auth provider in LemonMart, as covered in Chapter 6, Implementing Role-Based Navigation:
You must implement this custom auth provider in your Angular app.
The code sample for this section is in the projects/stage10 folder in the lemon-mart-app app or web-app folder.
- Start by creating a
baseUrlvariable inenvironment.tsso that we can connect to your server. - In
environment.tsandenvironment.prod.ts, implement abaseUrlvariable. - Also, select
authModeasAuthMode.CustomServer:web-app/src/environments/environment.ts web-app/src/environments/environment.prod.ts export const environment = { ... baseUrl: 'http://localhost:3000', authMode: AuthMode.CustomServer, - Install a helper library to programmatically access TypeScript enum values:
$ npm i ts-enum-util
...