WP > Middleware Auth#4
Merged
faisal-alvi merged 3 commits intofeature/issue-1-plugin-setupfrom Mar 6, 2025
Merged
Conversation
dkotter
requested changes
Mar 4, 2025
includes/classes/REST/Token.php
Outdated
| self::$route, | ||
| [ | ||
| 'methods' => WP_REST_Server::CREATABLE, | ||
| 'callback' => [ $this, 'validate_token' ], |
Collaborator
There was a problem hiding this comment.
I think we need a permission_callback here
|
|
||
| if ( empty( $token ) || empty( $refresh_token ) ) { | ||
| return new WP_Error( 'missing_tokens', 'Token and Refresh Token are required.', [ 'status' => 400 ] ); | ||
| wp_send_json_error( [ 'message' => 'Token and Refresh Token are required.' ], 400 ); |
Collaborator
There was a problem hiding this comment.
Should we pass this message through translation?
faisal-alvi
reviewed
Mar 5, 2025
Contributor
faisal-alvi
left a comment
There was a problem hiding this comment.
@TylerB24890 Thanks for the PR! Darin already covered the code review, everything else LGTM. However, I noticed that the token is stored for only 5 minutes, which may be too short. Depending on the use case, we might want to consider extending the expiration time?
…ings in i18n methods.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
/token/endpoint to/auth//token/endpoint for authenticating the WP token.wp_send_json_*functionsNOTE: Requires #3
How to test the Change
Changelog Entry
Credits
Props @username, @username2, ...
Checklist: