Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PricingService code
- ------------------
- this.getPriceBookList = function () {
- console.log("Enterted into getPriceBookList");
- var dataObj="grant_type=client_credentials";
- console.log("dataObj in getPriceBookList =" + angular.toJson(dataObj));
- var secret=clientKey+":"+clientPass;
- var base64Encoded= btoa(secret);
- var authorizationVal="Basic "+base64Encoded;
- console.log("authorizationVal in getPriceBookList = "+authorizationVal);
- $http({
- url: tokenAPI,
- method: 'POST',
- data: dataObj,
- withCredentials:true,
- headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" ,"Authorization":authorizationVal}
- }).then(function(response) {
- console.log("callTokenAPI result == " + JSON.stringify(response));
- var accessToken=response.data.access_token;
- console.log("callTokenAPI access token == " + accessToken);
- authorizationVal="Bearer "+accessToken;
- return $http({
- url: fetchPriceBookUrl,
- method: 'GET',
- withCredentials:true,
- headers: { "Content-Type": "application/json; charset=UTF-8" ,"Authorization":authorizationVal}
- });
- }, function(error) {
- console.log(error);
- });
- };
Add Comment
Please, Sign In to add comment