Search Posts

Category: cookies

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) { […]

Is it bad security to save jwt in cookie to pass it to local storage?

In order to get my twitter sign in to work with jwt sessions and angularjs, I have created a jwt with twitter username and display name, passed it as a cookie and saved it to local storage. Here’s some relevant code: Log in users and save cookie: app.get(‘/login/twitter’, passport.authenticate(‘twitter’)); app.get(‘/login/twitter/callback’, function(req, res) { passport.authenticate(‘twitter’ , {session: false} , function(err, user, info) { if(err) { console.log(err); } var token; token = user.generateTwitterJwt(); // res.status(200); // res.json({ […]

$cookies.get is not a function – Angular JS

Designed two pages. Cookies is not set and showing error. CDN: <script src = “”></script> <script src=””></script> Main Page – Set Cookies / cookies is not set var app = angular.module(‘myApp’, [‘ngCookies’]); app.controller(‘LoginCtrl’, [‘$cookies’, ‘$scope’, ‘$http’, ‘$window’, ‘$location’, function($cookies,$scope, $http, $window, $location) { $cookies.put(‘username’, ‘name’); } Second Page – Get Cookies var app = angular.module(‘myApp’, [ ‘ngTable’, ‘ngCookies’ , ‘ngResource’]); app.controller(‘AccountMappingCtrl’, [‘$scope’, ‘$http’,’$cookies’, ‘NgTableParams’, function($scope, $http, $filter, $cookies, NgTableParams) { $scope.UsernameCookies = $cookies.get(“username”); } It […]