Connection failed
-
I installed JWT according to the instruction and tested the /wp-json/jwt-auth/v1/token restpoint via POSTMAN. But I get this response here:
Connection failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
Any hint?
EDIT: /wp-json/jwt-auth/v1/token/validate works!
EDIT2: Maybe something was messed up when i implemented an internal call to that restpoint? Here is how I do this call:
$request = new WP_REST_Request( 'POST', '/jwt-auth/v1/token' ); $request->set_header("Content-Type","application/json"); $request->set_body('{"username": "'.$username.'", "password": "'.$password.'"}'); $response = rest_do_request( $request ); $server = rest_get_server(); $data = $server->response_to_data( $response, false ); $response = $data;
This call works by the way! It is just not reachable from the outside.
EDIT3: Seems to have to do with the filter. When I remove the filter it works. Check the code with deactivated filter:
function extend_token( $data, $user ) { $isProvider = get_user_meta($user->ID, "isProvider", true); if($isProvider == true) { $data['isProvider'] = 'true'; $profileData = get_profile_data_by_userId($user->ID); $data = array_merge($data, $profileData); $unitData = get_unit_data_by_userId($user->ID); $data = array_merge($data, $unitData); $offerData = get_offer_data_by_userId($user->ID); $data = array_merge($data, $offerData); $eventData = get_event_data_by_userId($user->ID); $data = array_merge($data, $eventData); } return $data; } //add_filter( 'jwt_auth_token_before_dispatch', 'extend_token', 10, 2 );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Connection failed’ is closed to new replies.