Closed Ashk2a closed 1 year ago
@Ashk2a We don't have equivalent. I will accept a MR for this.
Probably no code changes are needed, just use built in functions:
public function setUp(): void
{
parent::setUp();
$user = $this->createUser();
$this->actingAs($user, 'api');
}
https://laravel.com/docs/10.x/http-tests#session-and-authentication
@robsontenorio I'll try to do something like thast @lotyp Yes you can do that (and set key env variable as empty) but you can't retrieve information
I close the ticket, for the moment we can use actingAs
I do not have a user table in reality because all information related to users is being handled in Keycloak. In order to pass the middleware, I have created a redundant user
table to be able to use actingAs()
, which seems pretty odd. I think it would be better to have a mechanism to pass authentication without requiring the creation of a user. Something like this: $this->actingWithKeycloakToken()
.
I will try to delve into the Laravel source code and this package as well to find out how to accomplish this.
Hello,
I was using Laravel Passport before, the package proposes something like
Passport::actingAs
to simplify the generation of a token and authentication during tests.I haven't found an equivalent, but I'd like to know if there's a simple way to get the same behavior ?