session-cookies

cannot find module 'cookie' while using the express module

安稳与你 提交于 2019-12-11 00:03:15
问题 I need your help on building rest API using express.. I have tried many versions of express. that also have CookieParser middleware but I'm just getting the above error... Error: Cannot find module 'cookie' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17)` I installed the cookie-parser globally and using Express version 4.... the code snippet is below. var express = require('express'), cookieParser =

Add headers to request using Retrofit 2

主宰稳场 提交于 2019-12-10 23:45:41
问题 I'm trying to send requests with authentication headers, but it seems that the server cannot identify the client. I used this tutorial, and implemented an interceptor as follows: public class AuthenticationInterceptor implements Interceptor { private String authId; private String authToken; public AuthenticationInterceptor(String authId, String authToken) { this.authId = authId; this.authToken = authToken; } @Override public Response intercept(@NonNull Chain chain) throws IOException {

session not persisting when using secure cookie in NodeJS with express-session

狂风中的少年 提交于 2019-12-10 23:31:01
问题 I'm using NodeJS + express + express-session to persist a userID from anywhere in the application. On the first route, my session is defined userProfileRoutes.route('/authentication').post((req, res) => { req.session.userID = 10; //example console.log(req.session) } The result of the console.log is: Session { cookie: { path: '/', _expires: null, originalMaxAge: null, httpOnly: true, secure: true }, userID: 10 } // this is the right value But then, from a different route, I can't see the value

How to safely change the session cookie DOMAIN or name in production?

≡放荡痞女 提交于 2019-12-10 20:07:37
问题 We recently realized that our session cookie is being written out to the fully qualified domain name of our site, www.myapp.com , for example: MYAPPCOOKIE: 79D5DB83..., domain: www.myapp.com We want to switch this to being a cookie that can be shared cross subdomain, so any server at myapp.com can use the session cookie as well. For example, we'd like our cookie to store like so: MYAPPCOOKIE: 79D5DB83..., domain: .myapp.com We tried just changing our session cookie to use that domain like so:

How to force state server to throw away all sessions?

▼魔方 西西 提交于 2019-12-10 20:06:49
问题 I have an asp.net web app which uses state server to store its sessions. When we change a type of something which is stored in the session, all users with active sessions got error, beacuse the "old session" contains insrtances of "old type". I thought that the simplest way to overcome this problem would be to restart the state server, therefor get rid of all sessions. However, this was proffed to be a naive approach. Sessions seems to be still active (users with session old cookie are still

Angular 5 wont send auth cookie back

我怕爱的太早我们不能终老 提交于 2019-12-10 18:59:49
问题 I have an Angular 5 app and an ASP.net core 2.0 rest api. When they are both running on localhost, my authentication works just fine. I have recently deployed the rest api on another server and suddenly I can no longer authenticate. I have CORS enabled on the server via: app.UseCors(options => { options.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().AllowCredentials(); }); In Angular, I setup my request options: var headers: Headers = new Headers(); headers.append('Content-Type',

Rails 4 Encrypted Cookie Replay Attack

天大地大妈咪最大 提交于 2019-12-10 18:56:34
问题 I upgraded to Rails 4 recently and switched to encrypted cookies as session storage. Unfortunately this seems to mean that replay attacks are possible, i.e. if a user logs out, any cookies are not invalidated and can be used to authenticate without user/pass. As far as I can tell this is a flaw in how encrypted cookies work (if i'm wrong please enlighten me!), so my question is: is there an accepted solution to preventing replay attacks using encrypted cookies? 回答1: After some research and

Using session_name() in PHP - Cannot Access Data

邮差的信 提交于 2019-12-10 17:26:27
问题 When I use: session_name( 'fObj' ); session_start(); $_SESSION['foo'] = 'bar'; Subsequently loading the page and running: session_start(); print_r( $_SESSION ); doe not return the session data. If I remove the session_name(); it works fine. Does anyone know how to use sessions with a different session name? UPDATE : If I run the above code, as two page loads, and then change to: session_name( 'fObj' ); session_start(); print_r( $_SESSION ); I can access the data. However, if it will only work

Laravel 5 remember me not working

别等时光非礼了梦想. 提交于 2019-12-10 17:04:29
问题 I am unable to get Laravel rememeber me functionality to work. I added remember token column to my User Model table. My User Model Authenticatable . User model doesn't contain anything else specific related to remember me functionality I am using default Auth drivers and guard. My Usercontroller is different from default one. It extends from Controller . It doesn't use any Traits. In my login method, I use Auth::login($userModelObject, true) to login user. Everything works fine. Remember me

Why does Rails Fail to access the Session in an Ajax request from Internet Explorer?

半世苍凉 提交于 2019-12-10 14:47:09
问题 I have the following code in my sessions_helper: def current_user @current_user ||= User.find_by_remember_token(cookies[:remember_token]) end This let's me call current_user from any controller to get the current User. (I'm using authentication from scratch similar to Railstutorial's or Railscasts). I have ajax request called lookup_result that checks the server to see if a specific result is ready. $.get("/lookup_result?id=<%=id%>"); It goes to the following controller method: def lookup