2014-10-07 59 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:{

相关问题