2014-10-07 55 views
0

這是我的代碼:Azure中獲取令牌使用JavaScript角

$scope.getToken = function() { 
    // $scope.connect() 
    $http(
     { 
      method: 'POST', 
      url: $scope.urlToGetToken, 
      params: $scope.authParams, 
      headers: {"Content-Type": 'application/x-www-form-urlencoded'} 
     } 
    ). 
    success(function(data){ 
     console.log("whatever" + data); 
    }). 
    error(function(data, status, headers, config){ 
     console.log(data); 
     console.log(headers); 
     console.log(config); 
    }) 

    $scope.authParams = { 
     grant_type: 'authorization_code', 
     client_id: '03b****************ba-931c-3b19f204c736', 
     code: 'AAABAAAAv*********b', 
     redirect_uri: 'localhost:8080' 
    } 

儘管grant_type參數是有我得到400,出現以下錯誤:

"AADSTS90014: The request body must contain the following parameter: 
'grant_type'. ↵Trace ID: 

這是怎麼回事?

回答

0

params用於發送querysting中的數據。

使用data發送郵件正文中的數據。

$http({method: 'POST', url:$scope.urlToGetToken, data:$scope.authParams, headers:{

相關問題