Guest User

Untitled

a guest
Apr 30th, 2017
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  *
  3.  * @Author Rizki Mufrizal <mufrizalrizki@gmail.com>
  4.  * @Since Feb 14, 2016
  5.  * @Time 11:34:29 AM
  6.  * @Encoding UTF-8
  7.  * @Project Aplikasi-Absensi-Server
  8.  * @Package Expression package is undefined on line 8, column 15 in Templates/Other/javascript.js.
  9.  *
  10.  */
  11.  
  12. (function() {
  13.   'use strict';
  14.   angular.module('Aplikasi-Absensi')
  15.     .factory('AuthenticateService', AuthenticateService);
  16.  
  17.   AuthenticateService.$inject = ['$http', 'UrlService', '$base64', '$cookies'];
  18.  
  19.   function AuthenticateService($http, UrlService, $base64, $cookies) {
  20.     return {
  21.       loginProcess: function(login) {
  22.  
  23.         var data = {
  24.           client_id: 'clientapp',
  25.           client_secret: 123456,
  26.           scope: 'read',
  27.           grant_type: 'password',
  28.           username: login.npm,
  29.           password: login.password
  30.         };
  31.  
  32.         return $http({
  33.           method: 'POST',
  34.           url: UrlService.loginProcess(),
  35.           headers: {
  36.             'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
  37.             'Authorization': 'Basic ' + $base64.encode('clientapp:123456')
  38.           },
  39.           data: $.param(data)
  40.         });
  41.       }
  42.     };
  43.   }
  44.  
  45. })();
Add Comment
Please, Sign In to add comment