wp-graphql-woocommerce icon indicating copy to clipboard operation
wp-graphql-woocommerce copied to clipboard

Login generate a guest sessionToken

Open Shazamepool opened this issue 6 months ago • 0 comments

Describe the bug When a user logs in using the login method from the wp-graphql-jwt-authentication plugin, we expect to receive a sessionToken linked to the user. Instead, the plugin generates a guest session that is not associated with the user.

To Reproduce Steps to reproduce the behavior:

  1. Clear all the cache

  2. Send a SignIn Mutation mutation signIn($input: LoginInput!) { login(input: $input) { authToken refreshToken } }

  3. Get the session token from the response Header

  4. Parse it in https://jwt.io/ and you can't see that it's a guest token

Expected behavior We would like to be able to retrieve a user token that is linked to the session, along with the cart merge.

Plugin Versions

  • WooGraphQL Version: 0.21.2
  • WPGraphQL Version: 1.22.0
  • WordPress Version: 9.7.1
  • WooCommerce Version: 6.2.7

Additional context If we used the authToken we got from the login method in a customer query we will get the right customer id but the session token will still be link to a guest. (And the guest will change each time we run the query)

We send auth token with (Authorization: Bearer XXX) Header and the sessionToken with (woocommerce-session: Session XX) Header

Shazamepool avatar Jun 20 '25 15:06 Shazamepool