wp-graphql / wp-graphql-jwt-authentication

Authentication for WPGraphQL using JWT (JSON Web Tokens)
GNU General Public License v3.0
337 stars 74 forks source link

When the user is deleted and requesting new token: Internal Server Error. #181

Open BryarGh opened 9 months ago

BryarGh commented 9 months ago

So I want to resolve two things...

First: When I'm trying to Refresh the token and the user had been deleted... Second: When I'm trying to get data but token had been expired. Third: When I'm trying to get data but the user had been deleted...

Currently this is what I'm getting back from the server when the user had been deleted in the database..:

  "errors": [
    {
      "debugMessage": "Expected a value of type \"String\" but received: instance of WP_Error",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 8,
          "column": 15
        }
      ],
      "path": [
        "refreshJwtAuthToken",
        "authToken"
      ]
    }
  ],
  "data": {
    "refreshJwtAuthToken": {
      "authToken": null
    }
  },
  "extensions": {
    "debug": [],
    "queryAnalyzer": {
      "keys": "cdaff48a05f1e2423af450a1f1fd0862b5691026a6bb2f0493c45f97d18d580b graphql:Mutation operation:RefreshAuthToken",
      "keysLength": 108,
      "keysCount": 3,
      "skippedKeys": "",
      "skippedKeysSize": 0,
      "skippedKeysCount": 0,
      "skippedTypes": []
    }
  }
}

Query:

mutation RefreshAuthToken($jwtRefreshToken: String!) {
            refreshJwtAuthToken(
              input: {
                jwtRefreshToken: $jwtRefreshToken
              }
            ) {
              authToken
            }
          }