Authorization layer from Angular to NestJS

Hello,

I have implemented the universal login system in an Angular SPA and everything works correctly.

I have created a backend with NestJS to consume certain data from a database and I want the requests to be protected by Auth0.

Could someone guide me on what steps I can follow to dig into the documentation? I think these would be:

  1. Login from the Angular SPA.
  2. Once authenticated, when the auth token is received from Auth0 and this is saved in localstorage of the browser, make a request to my backend type to send this token and persist it in the database.
  3. From there, in each Angular request to the backend, send the auth token provided by Auth0 (through HttpInterceptor) in the headers and the backend checks if the token matches the one stored in the database.
  4. If so, process the request. If not, deny it.
  5. If denied, Angular must perform the deauthentication process in Auth0.

This is basically the idea. Am I on the right track? Any other ideas or suggestions?

Thanks

I have done an implementation exactly as I describe in the original post. I close the question!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.