Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds WPGraphQL JWT Auth fields to Customer type and mutations #148

Merged

Conversation

kidunot89
Copy link
Member

Your checklist for this pull request

Thanks for sending a pull request! Please make sure you click the link above to view the contribution guidelines, then fill out the blanks below.

🚨Please review the guidelines for contributing to this repository.

  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Make sure you are requesting to pull request from a topic/feature/bugfix branch (right side). Don't pull request from your master!

What does this implement/fix? Explain your changes.

This implements some fields, if WPGraphQL-JWT-Authentication is installed and activated.

Changes

  • adds the following fields to registerCustomer and updateCustomer output.
    • authToken JWT Token that can be used in future requests for Authentication
    • refreshToken A JWT token that can be used in future requests to get a refreshed jwtAuthToken
  • adds the following to the fields Customer type
    • jwtAuthToken A JWT token that can be used in future requests for authentication/authorization
    • jwtRefreshToken A JWT token that can be used in future requests to get a refreshed jwtAuthToken. If the refresh token used in a request is revoked or otherwise invalid, a valid Auth token will NOT be issued in the response headers.
    • jwtUserSecret A unique secret tied to the users JWT token that can be revoked or refreshed. Revoking the secret prevents JWT tokens from being issued to the user. Refreshing the token invalidates previously issued tokens, but allows new tokens to be issued.
    • jwtAuthExpiration The expiration for the JWT Token for the user. If not set custom for the user, it will use the default sitewide expiration setting. (Broken due to Type hinting bug in WPGraphQL-JWT-Authentication) See this
    • isJwtAuthSecretRevoked Whether the JWT User secret has been revoked. If the secret has been revoked, auth tokens will not be issued until an admin, or user with proper capabilities re-issues a secret for the user. (Broken due to Type hinting bug in WPGraphQL-JWT-Authentication) See this

Does this close any currently open issues?

Any relevant logs, error output, GraphiQL screenshots, etc?

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Any other comments?

Where has this been tested?

Operating System: Ubuntu 18.04

WordPress Version: 5.2.3

@kidunot89 kidunot89 added work in progress Solution development in progress bugfix Implements bugfix labels Oct 3, 2019
@kidunot89 kidunot89 added this to the v0.2.2 milestone Oct 3, 2019
@kidunot89 kidunot89 self-assigned this Oct 3, 2019
@kidunot89 kidunot89 merged commit f249194 into wp-graphql:develop Oct 16, 2019
@kidunot89 kidunot89 deleted the bugfix/customer-jwt-auth-fields branch October 16, 2019 15:01
@Raja0sama
Copy link

Raja0sama commented Oct 16, 2019

Okay so the authToken expires with in 5 minute or less, does refresh toekn eill get that renewd?

@kidunot89 kidunot89 mentioned this pull request Oct 24, 2019
6 tasks
@kidunot89 kidunot89 removed the work in progress Solution development in progress label Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Implements bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants