cookies

Why is req.cookies undefined?

北城以北 提交于 2020-01-03 13:08:30
问题 SITUATION: I am trying to check if my user is authenticated when he makes a request to the server. I googled a bit and found this: How to show different page if user is logged in via firebase So here's my try at implementing this solution using this library: https://github.com/js-cookie/js-cookie/blob/latest/src/js.cookie.js CODE: server-side var cookies = require("cookie-parser"); router.get("/", function(req, res, next){ const { token } = req.cookies; console.log('Verifying token', token);

Check if cookie exists in CodeIgniter

别来无恙 提交于 2020-01-03 10:47:33
问题 I'm using a search system, in PHP, that adds the text searched to an array and put it inside a cookie using json_encode(). The problem is: I need to check if the cookie already exists and, if not, create it. I'm using the following code to simply verify if it exists but without success: { $search = $this->input->post('search_text'); $types = $this->input->post('search_type'); $checkboxes = ""; if(!empty($types)) { foreach($types as $v) $checkboxes = $v.","; } //cookie $this->load->helper(

Can't delete cookie in express

本小妞迷上赌 提交于 2020-01-03 10:33:03
问题 Pretty simple. I set a cookie like so in my /user/login route: if (rememberMe) { console.log('Login will remembered.'); res.cookie('user', userObj, { signed: true, httpOnly: true, path: '/' }); } else { console.log('Login will NOT be remembered.'); } I've already set my secret for cookie-parser: app.use(cookieParser('shhh!')); Pretty basic stuff. Everything is working great insofar as I'm able to retrieve whatever I stored in the cookie: app.use(function (req, res, next) { if (req

Get and store the value of a cookie using Postman [closed]

末鹿安然 提交于 2020-01-03 10:09:33
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year . I need to get the value of a cookie, that is only created when I send a request in postman. I have tried everything but I don't know how to achieve this. I also need to store that value to use in further requests for my project. cookie name: JSESSIONID value:09840****************00C44 回答1: You could

Why do we need JWT when we have client sessions?

孤人 提交于 2020-01-03 09:24:34
问题 I understand that JWT are stateless tokens that store signed information about the client's claim and are passed to a server via the Authorization HTTP header. My question is, why do we need JWT when we already have client sessions (https://github.com/mozilla/node-client-sessions)? Client sessions are conceptually the same. They're cookies that contained signed information which when verified means the cookie hasn't been tempered with. Also, client sessions are stored in a cookie and passed

Android CookieManager setCookie creates multiple cookies

会有一股神秘感。 提交于 2020-01-03 09:19:07
问题 In my android application I have a webview. It loads URLs from multiple domains. I need to delete all cookies from a specific domain. I want to keep cookies from other domains. But I need to delete all cookies from one domain. I'm open to all other solutions that handles my request. (note that domain uses both http and https) But when I try to use CookieManager.setCookie, all available cookies for that domain didn't deleted. Multiple cookie keys appeear when I try to write to that keys. I

Passing cookies in Response.Redirect in ASP.NET

家住魔仙堡 提交于 2020-01-03 09:10:10
问题 I'm having a problem passing cookies in ASP.NET to a new URL. I add cookies to the Response like so: Response.Cookies.Add(new HttpCookie("Username", Username.Text)); I then issue a redirect: Response.Redirect(returnURL); On the new page that I am redirected to, the cookie collection is empty. I try to retrieve a cookie like so: Request.Cookies["Username"].Value; Can anyone think of why the cookies are not being passed? EDIT: Further info I forgot to add - on the second attempt within the same

Set cookies with Javascript to remember show state by click

喜夏-厌秋 提交于 2020-01-03 05:34:05
问题 Please, advice. I want to set cookies to my working simple javascript code. The div is showed by clicking on the link, but if the page reloads the div will hide. I need to set cookies to remember the show state for 7 days for e.g. Javascript function showDiv() { document.getElementById('auth_block').style.display = "block"; } HTML <a href="#" onclick="showDiv()"> <img src="/images/cont_btn.png"> </a> <div style="display:none;" id="auth_block">Some information</div> 回答1: With jQuery, you can

Set cookies with Javascript to remember show state by click

混江龙づ霸主 提交于 2020-01-03 05:34:02
问题 Please, advice. I want to set cookies to my working simple javascript code. The div is showed by clicking on the link, but if the page reloads the div will hide. I need to set cookies to remember the show state for 7 days for e.g. Javascript function showDiv() { document.getElementById('auth_block').style.display = "block"; } HTML <a href="#" onclick="showDiv()"> <img src="/images/cont_btn.png"> </a> <div style="display:none;" id="auth_block">Some information</div> 回答1: With jQuery, you can

Update WKWebView Cookie Values

China☆狼群 提交于 2020-01-03 05:26:17
问题 My Requirement is to update the cookies that are set to WKWebView . I'm able to update the cookies in NSHTTPCookieStorage , but the same cookies are not reflected to WKWebView cookies(The update values are present in NSHTTPCookieStorage but are not set to WKWebView ) The following is code that i have used to set that cookies to AJAX calls. NSString *strURL = DASHBOARDURL; NSURL *url = [NSURL URLWithString:strURL]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request