Skip to content

Instantly share code, notes, and snippets.

@Tmeister
Created August 4, 2015 16:47
Show Gist options
  • Save Tmeister/a2d42845337c763bc300 to your computer and use it in GitHub Desktop.
Save Tmeister/a2d42845337c763bc300 to your computer and use it in GitHub Desktop.
( 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] );
} );
} );
} )();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment