Skip to content

Commit 73ebd6f

Browse files
committed
Don't use once, just get the user by email if token is granted
1 parent 0276052 commit 73ebd6f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/GraphQL/Mutations/Login.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Joselfonseca\LighthouseGraphQLPassport\GraphQL\Mutations;
44

55
use GraphQL\Type\Definition\ResolveInfo;
6-
use Illuminate\Support\Facades\Auth;
76
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;
87

98
class Login extends BaseAuthResolver
@@ -20,8 +19,7 @@ public function resolve($rootValue, array $args, GraphQLContext $context = null,
2019
{
2120
$credentials = $this->buildCredentials($args);
2221
$response = $this->makeRequest($credentials);
23-
Auth::once(['email' => $args['data']['username'], 'password' => $args['data']['password']]);
24-
$user = Auth::user();
22+
$user = app(config('auth.providers.users.model'))->where('email', $args['data']['username'])->firstOrFail();
2523
$response['user'] = $user;
2624
return $response;
2725
}

0 commit comments

Comments
 (0)