wp-graphql / wp-graphql-jwt-authentication

Authentication for WPGraphQL using JWT (JSON Web Tokens)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

All requests sent with a fresh auth token return both a 403 AND the correct query results.

jeslenbucci opened this issue · comments

This is super confusing.

I'm using VueJS + NuxtJS + Apollo via the Nuxt-Vue-Apollo Module. When I send my initial login mutation to the server, I correctly receive both the authentication and refresh tokens. My authentication token is then sent for every subsequent graphql call.

The first query with the auth header happens immediately after login when I fetch a bunch of required data using the viewer type. The request "fails" by returning a 403, but then within the network error, when doing custom error handling with apollo, the correct result is also returned.

I'm pretty sure everything was working yesterday. However, I was recently trying out some other JWT plugins, and I'm not sure if it's possible that one of those is interfering with this. I have also changed the graphql_jwt_auth_secret_key using both the filter and the PHP definition.

Alright, possibly great news. I hadn't quite thought about whether or not other plugins could have caused issues with this one. I wiped the database and replaced it with a backup from a week ago, and it appears everything is working now.

Whether or not that was actually the case, I'm uncertain. In the event that anyone cares to look into this, here are all the other plugins I tried:

https://github.com/funkhaus/wp-graphql-cors
https://github.com/Tmeister/wp-api-jwt-auth
https://github.com/usefulteam/jwt-auth (pull request 33)

commented

For anyone looking into this issue, here is a small checklist of things to try.

  1. Deactivate any other JWT token plugins that may be active including those for the REST-API
  2. Make sure you are not sending refresh token requests in multiples or refreshing tokens before a new one is set.