Title: Validate access token using php function.
Last modified: April 5, 2017

---

# Validate access token using php function.

 *  [Ahmad Karim](https://wordpress.org/support/users/ahmadkarim/)
 * (@ahmadkarim)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/validate-access-token-using-php-function/)
 * Greetings,
 * I know there is an API endpoint (/wp-json/jwt-auth/v1/token/validate) to validate
   the token. Is there a way to validate the token using a php function. My case
   scenario is, once a user is logged in he can request other data from the server.
   So while making a request for page_1 I would like to validate the token that 
   is being sent with the AJAX request.
 * Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [jvertucio](https://wordpress.org/support/users/jvertucio/)
 * (@jvertucio)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/validate-access-token-using-php-function/#post-9235270)
 * When passing auth token, `wp_get_current_user()` can be used to get the current
   user. If the return id is `0` then the token is invalid. Simple, really.
 *  [Kerygmata](https://wordpress.org/support/users/kerygmata/)
 * (@kerygmata)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/validate-access-token-using-php-function/#post-9617887)
 * [@jvertucio](https://wordpress.org/support/users/jvertucio/) What about when 
   we don’t have a current user and are coming from a third party scenario interacting
   with this?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Validate access token using php 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/)

 * 2 replies
 * 3 participants
 * Last reply from: [Kerygmata](https://wordpress.org/support/users/kerygmata/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/validate-access-token-using-php-function/#post-9617887)
 * Status: not resolved