Search⌘ K
AI Features

Auth Service - Current User

Explore how to decode JSON Web Tokens using Angular's AuthService to retrieve the current user's ID. This lesson guides you through updating tests and implementing a method to access user data, enabling you to create authenticated events effectively.

Within the request body to create an event is a user ID, _creator. At the moment, we don’t have a way to access the ID of a logged-in user to add this to the request body. Thankfully, the id for the current user is provided to us by the API when it gives us a JWT. To get this value, we’ll need to decode the token to access it by creating a new method in ...