wp-graphql / wp-graphql-woocommerce

Add WooCommerce support and functionality to your WPGraphQL server
https://woographql.com
GNU General Public License v3.0
643 stars 130 forks source link

updateCustomer Query unable to update ShippingAddress #862

Closed alejdig closed 4 months ago

alejdig commented 4 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Use the UpdateCustomerMutation

  2. Send a Payload that uses billing such as

    const res = await client.mutation({
      updateCustomer: {
        __args: {
          input: {
            id,
            email,
            lastName,
            firstName,
            **shipping**
          },
        },
        __scalar: true,
      },
    });
  3. See Error Network response was not ok. Status: 403

  4. Use the mutation with the billing Address Instead

5 Billing Address gets updated, error Code is still 403. Network response was not ok. Status: 403 but the changes do get reflected in the response

CleanShot 2024-05-25 at 13 11 44 CleanShot 2024-05-25 at 13 11 22@2x

Expected behavior Should update the shipping address

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Plugin Versions

Additional context Add any other context about the problem here. Network response was not ok. Status: 403

alejdig commented 4 months ago

This is very interesting, as can be seen, i get a forbidden 403 response but the edit still goes through?

https://github.com/wp-graphql/wp-graphql-woocommerce/assets/139802813/51e7e746-67bf-47b9-9d4f-a2a885a038a7

Invalid Secret key

{
                "type": "GRAPHQL_DEBUG",
                "message": "invalid-secret-key | Signature verification failed",
                "stack": [
                    "\/var\/www\/vhosts\...com\/wp-content\/plugins\/wp-graphql-headless-login\/src\/Auth\/Request.php:33"
alejdig commented 4 months ago

Solved: This happened because i had https://github.com/wp-graphql/wp-graphql-jwt-authentication installed and i was using it's jwtRefreshToken instead of the authToken from headless-login