joselfonseca / lighthouse-graphql-passport-auth

Add GraphQL mutations to get tokens from passport for https://lighthouse-php.com/
https://lighthouse-php-auth.com/
MIT License
228 stars 56 forks source link

Duplicate definition login found when merging #173

Closed M7MMAD-OMAR closed 3 months ago

M7MMAD-OMAR commented 4 months ago

{ "errors": [ { "message": "Internal server error", "extensions": { "debugMessage": "Duplicate definition login found when merging.", "file": "R:\NewProjects\PhpstormProjects\University-Selector-Back-End-API\vendor\nuwave\lighthouse\src\Schema\AST\ASTHelper.php", "line": 74, "trace": [

    =========

        extend type Mutation {
          login(input: LoginInput @spread): AuthPayload! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\Login@resolve")
          refreshToken(input: RefreshTokenInput @spread): RefreshTokenPayload! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\RefreshToken@resolve")
          logout: LogoutResponse! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\Logout@resolve")
          forgotPassword(input: ForgotPasswordInput! @spread): ForgotPasswordResponse! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\ForgotPassword@resolve")
          updateForgottenPassword(input: NewPasswordWithCodeInput @spread): ForgotPasswordResponse! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\ResetPassword@resolve")
          register(input: RegisterInput @spread): RegisterResponse! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\Register@resolve")
          socialLogin(input: SocialLoginInput! @spread): AuthPayload! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\SocialLogin@resolve")
          verifyEmail(input: VerifyEmailInput! @spread): AuthPayload! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\VerifyEmail@resolve")
          updatePassword(input: UpdatePassword! @spread): UpdatePasswordResponse! @field(resolver: "Joselfonseca\\LighthouseGraphQLPassport\\GraphQL\\Mutations\\UpdatePassword@resolve") @guard(with: ["api"])
      }
sandromedina commented 4 months ago

The same error when I tried to use the #import directive to include the auth.graphql in schema.graphql. I solved the problem following the intructions to edit the files schema.graphql and auth.graphql as described in https://lighthouse-php-auth.com/tutorials/getting-started/

M7MMAD-OMAR commented 3 months ago

Okay, thank you. Do the tools work well for you? Like resetting the password and other available functions?

M7MMAD-OMAR commented 3 months ago

and VerifyEmail is work ?

sandromedina commented 3 months ago

All functions works. Take into account that both, forgotPassword and verifyEmail, requires more coding to complete the functionality: See https://lighthouse-php-auth.com/docs/usage/#email-verification. I understand better how every mutation works looking at the tests https://github.com/joselfonseca/lighthouse-graphql-passport-auth/tree/master/tests/Integration/GraphQL/Mutations)