ログイン情報を Cookie に保存しようとしています。私の方法の後、Cookieは適切なデータで登録されます。しかし、次のページにリダイレクトすると、Cookie が失われます。理由がわかりません。誰かが私を説明できるなら。
これは私のログイン方法です:
$scope.Login = function()
{
var expireDateCookies = new Date();
expireDateCookies.setHours(expireDateCookies.getHours() + 6);
// default post header to url encoded content
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
//variable who contains the authentication information
var auth = $scope.auth;
var requestGetToken = $http({ method: 'POST', url: url, headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, data: $.param({ username: auth.Login, password: auth.Password, grant_type: 'password', client_id: client_id }) });
requestGetToken.success(function (data) {
$cookieStore.put('access_token', data.access_token, { 'expires': expireDateCookies });
});
// default post header to json
$http.defaults.headers.post['Content-Type'] = 'application/json';
$window.location.href = '/CustomersList';
}
あなたが私に与えることができるすべての助けに感謝します.