Skip to content

JWT token could not be returned #69

@henrikwirth

Description

@henrikwirth

There seems to be a bug with the newest versions:

WPGraphQL: 0.6.1
JWT: 0.3.5

When doing the registerUser mutation like so:

mutation RegisterUser($input: RegisterUserInput!) {
  registerUser(input: $input) {
    user {
      jwtAuthExpiration
      jwtUserSecret
      jwtRefreshToken
      isJwtAuthSecretRevoked
      jwtAuthToken
    }
  }
}

The user gets registered, but the response is the following:

{
  "errors": [
    {
      "message": "The user secret could not be returned",
      "category": "user",
      "locations": [
        {
          "line": 5,
          "column": 7
        }
      ],
      "path": [
        "registerUser",
        "user",
        "jwtUserSecret"
      ]
    },
    {
      "message": "The JWT token could not be returned",
      "category": "user",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],
      "path": [
        "registerUser",
        "user",
        "jwtRefreshToken"
      ]
    },
    {
      "message": "The JWT token could not be returned",
      "category": "user",
      "locations": [
        {
          "line": 8,
          "column": 7
        }
      ],
      "path": [
        "registerUser",
        "user",
        "jwtAuthToken"
      ]
    }
  ],
  "data": {
    "registerUser": {
      "user": {
        "jwtAuthExpiration": "1580566063",
        "jwtUserSecret": null,
        "jwtRefreshToken": null,
        "isJwtAuthSecretRevoked": false,
        "jwtAuthToken": null
      }
    }
  }
}

So it seems for some reason inside ManageTokens.php the following calls don't work as intended:

  • Auth::get_user_jwt_secret
  • Auth:: get_token
  • Auth:: get_refresh_token

Also the error message of refresh token should be different to the one from the token.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions