Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customerRegister mutation resolves wrong object for viewer field #111

Closed
mlipscombe opened this issue Jul 16, 2019 · 2 comments
Closed

customerRegister mutation resolves wrong object for viewer field #111

mlipscombe opened this issue Jul 16, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mlipscombe
Copy link

Describe the bug
The resolver for the viewer field of the customerRegister mutation returns a WPGraphQL\Model\User, but the JWT plugin expects a \WP_User object.

Attempting to use any JWT fields in the resulting viewer field gives the following error:

Argument 1 passed to WPGraphQL\JWT_Authentication\ManageTokens::WPGraphQL\JWT_Authentication\{closure}() must be an instance of WP_User, instance of WPGraphQL\Model\User given

To Reproduce
Install wp-graphql-jwt-authentication, and perform the following mutatoin:

mutation RegisterMutation($input: RegisterCustomerInput!) {
  registerCustomer(input: $input) {
    viewer {
      jwtAuthToken
      jwtRefreshToken
    }
  }
}
@kidunot89
Copy link
Member

kidunot89 commented Jul 16, 2019

Good catch, the User model is being resolved incorrectly. However as of 0.2.0, you should be able to get the JWT fields on the customer type too.

@kidunot89 kidunot89 self-assigned this Jul 16, 2019
@kidunot89 kidunot89 added the bug Something isn't working label Jul 16, 2019
@mlipscombe
Copy link
Author

This appears to be a bug in the JWT plugin, not this one, so closing this. Sorry for the noise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants