Posts

Showing posts with the label cookies

How does OnValidateIdentity ASP.NET Identity work

Image
Clash Royale CLAN TAG #URR8PPP How does OnValidateIdentity ASP.NET Identity work I'm trying to understand better how .NET's Identity OnValidateIdentity method works exactly. I have set up this piece of code in my application like following: app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), CookieName = "LoginCookie", ExpireTimeSpan = TimeSpan.FromHours(1), Provider = new CookieAuthenticationProvider { // Enables the application to validate the security stamp when the user logs in. // This is a security feature which is used when you change a password or add an external login to your account. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>( validateInterval: TimeSpan.FromH...

WebSocket handshake cookies cloudfront deployment

Image
Clash Royale CLAN TAG #URR8PPP WebSocket handshake cookies cloudfront deployment I have an angular 6 app & python(django 2.0.6) back-end. Angular 6 app is deployed using AWS S3 & CloudFront. Angular 6 app use websocket functionality. Everything works well locally, but when deployed Angular 6 app fails to pass a cookies with websocket handshake request. (Authorization is by cookies only for websoket connection. There are reasons for that, not relevant.) Websocket server located at subdomain: `api.site.com`` i tried multiple ways to set cookies in angular 6 app, such as: let domain = 'api.site.com' document.cookie = `Token=${token}; domain=${domain}; path=/`; document.cookie = `Token=${token}; path=/`; document.cookie = `Token=${token}; document.cookie = `Token=${token}, domain=${domain}, path=/`; using ngx-cookie-service : ngx-cookie-service this.cookieService.set('Token', token, undefined, '/', 'api.site.com'); this.cookieService.set('Token...

Accessing Cookies API from a React WebExtension

Image
Clash Royale CLAN TAG #URR8PPP Accessing Cookies API from a React WebExtension Summary I'm trying to access the Cookies API from a WebExtension which uses React, but I don't know why, it throws a TypeException, as if browser.cookies did not exist. browser.cookies I've checked permissions and the code is copy/pasted from the MDN docs... but still I can't get it to work. Exception: TypeError: browser.cookies is undefined Code This is the main component: import React from 'react'; import ReactDOM from 'react-dom'; class Popup extends React.Component { constructor(props) { super(props); this.state = { sessionId: null }; } componentDidMount() { var getting = browser.cookies.getAllCookieStores(); // This throws "TypeError: browser.cookies is undefined" getting.then(logStores); } render() { return ( <div> <h1>My App</h1> </div> ...