Title: usage
Last modified: February 13, 2018

---

# usage

 *  [gamer2300](https://wordpress.org/support/users/gamer2300/)
 * (@gamer2300)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/usage-27/)
 * well i obtain a token but after i don’t know of conitnue with this (look under
   in my topic..) well where i must put that code inside first angular function?
 *  Once you get the token, you must store it somewhere in your application, ex.
   in a cookie or using localstorage.
 * From this point, you should pass this token to every API call
 * Sample call using the Authorization header using AngularJS
 * app.config( function( $httpProvider ) {
    $httpProvider.interceptors.push( [ ‘
   $q’, ‘$location’, ‘$cookies’, function( $q, $location, $cookies ) { return { ‘
   request’: function( config ) { config.headers = config.headers || {}; //Assume
   that you store the token in a cookie. var globals = $cookies.getObject( ‘globals’)
   || {}; //If the cookie has the CurrentUser and the token //add the Authorization
   header in each request if ( globals.currentUser && globals.currentUser.token ){
   config.headers.Authorization = ‘Bearer ‘ + globals.currentUser.token; } return
   config; } }; } ] ); } );
 * The wp-api-jwt-auth will intercept every call to the server and will look for
   the Authorization Header, if the Authorization header is present will try to 
   decode the token and will set the user according with the data stored in it.
 * If the token is valid, the API call flow will continue as always.

The topic ‘usage’ 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/)

 * 0 replies
 * 1 participant
 * Last reply from: [gamer2300](https://wordpress.org/support/users/gamer2300/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/usage-27/)
 * Status: not resolved