You can just extract those first 2 if's into separate methods (or single method), returning the user at the same time.
Something like `getUserOrThrow()` (Returning the `User` instance, not `Optional`, because either you return a valid user or throw your exception).

You can use that anywhere you need to ensure you have user instance.

You could do the same to get the token if that's what is the most common data necessary for your logic further.