szali172 / anonymous-chats-frontend

1 stars 0 forks source link

Piece of Advice #12

Open yithril opened 1 month ago

yithril commented 1 month ago

https://github.com/szali172/anonymous-chats-frontend/blob/1d32c335fcb6158b0fa79e0e18412a301dd27f74/src/app/services/user-service.service.ts#L15

When you integrate Auth0 in the front end, there is a method for you to get the current User from the built-in Auth service that Auth0 provides you. You just need to make sure the user id isn't null, and then you can make it into a variable.

You also prolly want to look into Auth Guards to make certain you're not in a position where someone not logged in is looking at a page that will make requests assuming there is a user.