REST API: best place to set current user for JWT auth?


I’ve studied a couple of JWT auth plugins and notice the current user is being set in either the rest_api_init action:

add_action( 'rest_api_init', function () {

Or in the determine_current_user filter:

add_filter( 'determine_current_user', function ($user_id) {
  return $token->user_id;

Any advice as to which one is better? I’ve tested with both and they seem to have the same effectiveness.

, mos fetish 4 days 0 Answers 17 views 0

Leave an answer