php-graphql-client icon indicating copy to clipboard operation
php-graphql-client copied to clipboard

Trying to implement login mutation [Sorare]

Open faridmovsumov opened this issue 3 years ago • 2 comments

Hello, I am trying to build a query for the following mutation, already spent hours but something is wrong.

image

This is my code

image

Really appreciate it if someone can help.

faridmovsumov avatar Feb 19 '22 15:02 faridmovsumov

I am getting the following response

image

faridmovsumov avatar Feb 19 '22 15:02 faridmovsumov

Pasting also my code to make it easier to help :D

        $mutation = (new Mutation('signIn'))
            ->setOperationName('SignInMutation')
            ->setArguments(
                [
                    'input' => new RawObject('{email: "[email protected]", password: "'.$hashedPassword.'"}'),
                ])
            ->setSelectionSet([
                (new Query('currentUser'))
                    ->setSelectionSet(
                        [
                            'slug',
                            'id',
                            (new Query('jwtToken'))->setSelectionSet([
                                'token',
                                'expiredAt'
                            ])->setArguments(['aud' => 'farid'])
                        ]
                    ),
                (new Query('errors'))
                    ->setSelectionSet(
                        [
                            'message',
                        ]
                    ),
                ],

            );
        $results = $client->runQuery($mutation);

        dd($results);

faridmovsumov avatar Feb 19 '22 15:02 faridmovsumov