Open simonh1000 opened 1 year ago
Please answer the following questions for yourself before submitting an issue.
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
I'm not a PHP specialist, so i'm just trying to extend code I fond on stackoverflow
I have
add_action( 'jwt_auth_token_before_sign', 'jwt_token', 10, 2 ); function jwt_token($token, $user) { $data = [ 'user' => [ 'id' => $user->data->ID, 'name' => $user->data->display_name, 'roles' => implode(',', $user->roles) ] ]; $token['data'] = $data; return $token; }
the trouble is that when this returns after an auth request I get
Array{ "token": "eyJ0e...NcbMJcQ", "user_email": "...@gmail.com", "user_nicename": "xyz", "user_display_name": "xyz" }
the word Array is then messing up the parsing in the client
Array
Any ideas how to return a $token that continues to json encode properly?
$token
Issue Name
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Expected Behavior
I'm not a PHP specialist, so i'm just trying to extend code I fond on stackoverflow
I have
the trouble is that when this returns after an auth request I get
the word
Array
is then messing up the parsing in the clientAny ideas how to return a
$token
that continues to json encode properly?