Search Posts

Category: cookies

Cookies Not Properly Being Set Using Document.cookie

I am currently using an older version of Angular (1.2) that does not allow me to pass options to the $cookies API in order to specify other properties such as Secure, or expiration date. I instead created a small custom service that uses the native document.cookie API so that I can create my own cookie strings. Testing my application on localhost, the cookies were being properly set but now that I’ve deployed my app, I […]

How to make AngularJS (1.2) cookies persist through multiple redirects?

Is it possible to have cookies in Angular (either from the $cookies or $cookiesStore service) persist through multiple redirects? I’m currently using version 1.2.28 of AngularJS and my flow is as follows: Create cookies Redirect to an identity provider for authentication (Azure for example) Come back to the redirect controller and compare the values received from the redirect with cookies that were set beforehand It seems like my cookies are being removed when I come […]

AngularJS cookie with array

how to AngularJS cookie with array I send my data like this $cookies.putObject(“currentLocation,values,allLocList”, obj, vm.tempData, vm.allLocationList); obj and vm.tempData are objects. But vm.allLocationList is array that contains a JSON object. In my state file, I get data with resolve: { entity: function($cookies) { return { location: $cookies.getObject(“currentLocation”), values: $cookies.getObject(“values”), allLocationList: $cookies.getObject(“allLocList”) }; } } Then when i go to controller, entity.location is okey,entity.values is okey but entity.allLocList is undefined.Do you have any idea? Source: AngularJS

How to share a cookie between subdomain in angularjs

how to How to share a cookie between subdomain in angularjs i have two apps in angularjs, deployed in an apache httpd like: archivo.localhost/ and oficio.localhost/ I’m creating my cookies with $cookies like: var cookieConfig = { expires: cookieExpireDate.toUTCString(), path: “/”, domain: “localhost” }; $cookies.put(‘oficio-token’, response.ticket, cookieConfig); and reading them with: $cookies.get(‘oficio-token’); but trying to read the oficio cookies from archivo, i can’t see them, how should i read or create those cookies to be […]

How to access already existing cookies in angular 5 from browser

I have a node app and when login is success Iam storing a token and customer id in cookies.Then on a button click Iam routing it to my angular 5 application.Now I need those two cookie values to be used in my angular 5 application.Iam able to still see those cookie values in browser but unable to access those cookies Image here console.log(“cookies”,this.cookieService.get(‘customerid’)); I tried using ngx-cookie-service but using this Iam able to access newly […]

how to delete a cookie if the browser crashes

I have a situation in my application where the users should are not allowed to open multiple instances of the application in a browser. So we are reading the cookies, if there is a session already opened we alerting the user that they are attempting to open multiple sessions. Some times if the browser crashes for some reason the browser is still having the old cookie and when the user is attempting to open the […]

About AngularJS pagination (I used localStorageService before but it wasn’t the solution i wanted to apply)

First, Thank you for watching this question! I’m newbie to angularJS and i’m trying to make pagination to be more flexible to use. Below is my situation. I made pagination function It works as my intention But, When i get into other page(leave list page which includes pagination function), and try to go back, the problem appears! (Here is what i want to solve) I go back to list page by clicking backspace key or […]

Centralized session in multiple product having different domain

I am developing centralized admin module for multiple product. Trying to maintain same session across multiple product. For Product1 : Authenticate successfully and send token in response header Request URL:http://localhost:8080/admin-web/rest/authenticate/ Request Headers Accept:application/json, text/plain, */* Accept-Encoding:gzip, deflate Accept-Language:en-US,en;q=0.8 Cache-Control:no-cache Connection:keep-alive Host:localhost:8080 Origin: Pragma:no-cache Referer: User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36 Response Headers Set-Cookie:token=asdf123sfs1f23sfsf321sfsf21; Version=1; Comment=””; Domain=localhost; Path=/ Access-Control-Allow-Credentials:true Access-Control-Allow-Origin: Content-Encoding:gzip Content-Type:application/json Date:Mon, 13 Nov 2017 12:38:27 GMT Server:Apache-Coyote/1.1 Transfer-Encoding:chunked Vary:Origin Vary:Accept-Encoding […]

how to call $cookies variable in module

i have following method and i want to show rights if isadmin = ‘1’ show this manuitem and if isadmin = ‘0’ not show this manu how to solve this type of logic please help me this thanks, when i refresh my url its work but when i logout and again login its not working (function () { ‘use strict’; angular .module(‘app.adduserbrand’, []) .config(config); /** @ngInject */ function config($stateProvider, $translatePartialLoaderProvider, msApiProvider, msNavigationServiceProvider) { // State […]

Angular.JS $cookies are empty

I am trying to read a cookie value coming to me in response from my REST-server and always get undefined. Cookies in Chromium and Firefox are enabled(Though only firefox can show that cookie is present).The code below is the method which makes a call to rest api and where I am trying to read the response $scope.createUser = function (user) { $http({ method: ‘POST’, url: baseURL + “/create_user”, headers: {‘Content-Type’: ‘application/x-www-form-urlencoded’}, transformRequest: function (obj) { […]

Next Page »