Title: Use a encrypted password with the wp_get_current_user function
Last modified: May 9, 2018

---

# Use a encrypted password with the wp_get_current_user function

 *  [royvdl](https://wordpress.org/support/users/royvdl/)
 * (@royvdl)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/use-a-encrypted-password/)
 * 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 );
       ```
   
    -  This topic was modified 7 years, 11 months ago by [royvdl](https://wordpress.org/support/users/royvdl/).
      Reason: Better title

The topic ‘Use a encrypted password with the wp_get_current_user function’ is closed
to new replies.

 * ![](https://ps.w.org/jwt-authentication-for-wp-rest-api/assets/icon-256x256.jpg?
   rev=3372068)
 * [JWT Authentication for WP REST API](https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jwt-authentication-for-wp-rest-api/)
 * [Active Topics](https://wordpress.org/support/plugin/jwt-authentication-for-wp-rest-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jwt-authentication-for-wp-rest-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jwt-authentication-for-wp-rest-api/reviews/)

## Tags

 * [encrypted](https://wordpress.org/support/topic-tag/encrypted/)
 * [password](https://wordpress.org/support/topic-tag/password/)
 * [rest](https://wordpress.org/support/topic-tag/rest/)

 * 0 replies
 * 1 participant
 * Last reply from: [royvdl](https://wordpress.org/support/users/royvdl/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/use-a-encrypted-password/)
 * Status: not resolved