Auth Service - Current User

Let's add a method to our auth service to decode the JWT token to access the current user's ID.

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 AuthService.

Below is our updated code. Use this to make further changes in the lesson.

Get hands-on with 1400+ tech skills courses.