I have just set up a small Laravel API that is protected via Passport that was introduced in 5.3. So far, everything is working well.
Since I will be the only one consuming the API, I simply added \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class to my web middleware-group in order to generate and handle my API tokens.
To my question: How may I handle tokens in my application tests? actingAs($user) does not seem to magically add the user's token to the request. I can use $this->withoutMiddleware();, but then all middleware is disabled, and not only the one responsible for authentication.
Any ideas on how to solve this?
Thank you very much for you help!
Aucun commentaire:
Enregistrer un commentaire