I’m wondering what would be the smartest way to share the user’s credentials with the pages of your app. Let’s take the userId for example. That’s something that you probably need on almost any page of your app.
Do you call the backend server on any page then to authenticate the user and receive the current user’s Id (which is somehow time consuming and relying on a stable connection)? Or do you somehow authenticate the user once and then share the credentials with all pages of your app?
I thought about receiving the credentials once (in app.components.ts) and then share it using events. But this didn’t really work out…
How do you deal with this?
EDIT: Just re-read this post. It indeed sounds like I want to call the backend directly from the pages. Of course I didn’t intend to do this. I meant calling the provider to communicate with the backend instead.