# How do I run an angularjs script to get a json token response?

**URL:** <https://community.auth0.com/t/how-do-i-run-an-angularjs-script-to-get-a-json-token-response/8541>\
**Category:** Get Help\
**Tags:** angularjs\
**Created:** [October 21, 2017, 3:00am UTC](https://community.auth0.com/t/how-do-i-run-an-angularjs-script-to-get-a-json-token-response/8541 "2017-10-21T03:00:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghopshtein](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@ghopshtein](https://community.auth0.com/u/ghopshtein)\
**Post date:** [October 21, 2017, 3:00am UTC](https://community.auth0.com/t/how-do-i-run-an-angularjs-script-to-get-a-json-token-response/8541/1 "2017-10-21T03:00:21Z")

</div>

Hello Everyone,

I am a total n00b and dont know what I am doing. I dont even know if this is the correct place to do this.

I have a script from a JWT plugin for wordpress. I need to parse this to get my token. I just dont know where to do this/how to do this. The script is below:

( function() {  
var app = angular.module( ‘jwtAuth’, ] );

app.controller( ‘MainController’, function( $scope, $http ) {

```
var apiHost = 'http://yourdomain.com/wp-json';

$http.post( apiHost + '/jwt-auth/v1/token', {
    username: 'admin',
    password: 'password'
  } )

  .then( function( response ) {
    console.log( response.data )
  } )

  .catch( function( error ) {
    console.error( 'Error', error.data[0] );
  } );

```

} );

} )();

This came from : [wp-api-jwt-auth/README.md at develop · Tmeister/wp-api-jwt-auth · GitHub](https://github.com/Tmeister/wp-api-jwt-auth/blob/develop/README.md)

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/how-do-i-run-an-angularjs-script-to-get-a-json-token-response/8541/2 "2018-03-02T05:57:04Z")

</div>


