Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var loginObj = {
- 'username': $scope.username,
- 'password': $scope.password,
- 'grant_type': 'password',
- 'client_id': 'web'
- }
- var doLogin = $http({
- method: 'POST',
- url: 'https://api/v1/token',
- headers: {'Content-Type': 'application/x-www-form-urlencoded'},
- transformRequest: function(obj) {
- var str = [];
- for(var p in obj) {
- str.push(encodeURIComponent(p) + '=' + encodeURIComponent(obj[p]));
- }
- return str.join('&');
- },
- data: loginObj,
- responseType: 'json'
- })
- doLogin.then(
- onLoginSuccess,
- onLoginError
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement