Use a encrypted password with the wp_get_current_user function
-
Hi,
Thanks for the plugin.
We using the plugin now on a development version. And like to use it on a production version. Therefore we like to create a JWT token per user.
We using PHP and Javascript, below is the code.
wp_localize_script( 'jwt', 'username', 'test' ); wp_localize_script( 'jwt', 'password', 'test' );
const set_token = axios( { method: 'post', url: 'https://url.local/wp-json/jwt-auth/v1/token', data: { username: username, password: password } } ).then( function( response ) { console.log( response ); } ) .catch( function( error ) { console.log( error ); } );
Now we like to user the wp_get_current_user function, is this possible? Because using the following code won’t work. Or are we going in the wrong direction?
$current_user = wp_get_current_user(); wp_localize_script( 'jwt', 'username', $current_user->data->user_login ); wp_localize_script( 'jwt', 'password', $current_user->data->user_pass );
- The topic ‘Use a encrypted password with the wp_get_current_user function’ is closed to new replies.