How to get Access Token from ASP.Net Web API 2 via AngularJS $http?

前端 未结 6 1910
孤街浪徒
孤街浪徒 2021-02-04 02:12

I try like this:

$http({ method: \'POST\', url: \'/token\', data: { username: $scope.username, password: $scope.password, grant_type: \'password\' } }).success(f         


        
6条回答
  •  日久生厌
    2021-02-04 02:44

    Do this:

    $http({
            url: '/token',
            method: 'POST',
            data: "userName=" + $scope.username + "&password=" + $scope.password + 
                  "&grant_type=password"
    })
    

提交回复
热议问题