Questions tagged cookies

Explore the latest questions and answers asked by our top developers.

Laravel Sanctum – How often should i refresh the csrf-cookie

I’m building an SPA with Angular and Laravel. I’m using Laravel Sanctum for authentication and CSRF-Protection. Currently, I’m sending the GET-Request this.http.get(‘/sanctum/csrf-cookie’).subscribe(); to get a new CSRF-Cookie before every single Request. I think this is a bit too much. How often should I Request a new Cookie? Only when the Cookie is not valid (when i […]

Ngx-cookie-service: shared cookie between domain and its subdomain is not available

I use Angular 12 library and "ngx-cookie-service": "10.1.1". I tried to add cookie (contains user data) for a domain (localhost) and its subdomains (sub1.localhost, sub2.localhost). MyApp running on localhost sets a cookie: this.cookieService.set(‘cookiename’, ‘v’, 36000000, ‘/’, ‘localhost’); export class AuthService { constructor(private cookieService: CookieService) { } } but MyApp running on sub1.localhost is not able […]

By ael
Categorized as angular, cookies, ngx-cookie-service, subdomain Tagged , , ,

Set-Cookie with samesite=none and secure attribute requires https connection in Chrome

I currently have my personal web application which supports login using Spring Security deployed in AWS. However, Chrome blocks cross-site Set-Cookies in my response header when I attempt to login(My backend hosted in EC2 and frontend in S3 bucket). The way to handle it was to set the attributes of the cookie: samesite=none and secure. […]

Angular -> Put Username from Cookie into Inputfield

I have a Webapplication with oAuth, the Webapplication contains a Inputifeld for the Users loginName. The Loginname also is in the Cookie from the oAuth. I now want to get that username from the Cookie and put it into the inputfield so that the User doesen’t has to type it in by themselves. But the […]

Why sessions cookies are not saved in browser?

I’m making a website with angular and I use Flask as my API. Everythings was ok until now, but I want to use session with flask, so I have to get the session cookie and send it back. The probleme is : Cookies are not saved on my browsers (Firefox/Google Chrome). When I try with […]

By Unknow
Categorized as angular, api, cookies, flask, session Tagged , , , ,

HttpOnly cookie generated on the server is present in Set-Cookie header but is not being saved while running locally

I have an Angular application with Spring boot in the backend. On the server side I generate an HttpOnly cookie, which is then to be saved. @CrossOrigin(origins = "*", allowedHeaders = "*", allowCredentials = "true") @GetMapping("token") public AuthenticationResponseDto generateToken( HttpServletResponse response) {"Creating token"); String username = "user"; String password = "pass"; authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password)); […]

By techyyy
Categorized as angular, cookies, http, spring-boot, web Tagged , , , ,

Angular CORS cookie

I am working on the frontend to my API and running into an issue with it sending the cookie along with the request to the API. I am using the ngx-cookie-service and in my HTTP client, I am using withcredientials: true but the cookie is still not going to the API server with the given […]

By Joe
Categorized as angular, cookies Tagged ,

Suppress cookie requests in Electron Chromium browser

Amongst other content our Angular-based Electron application displays websites in a digital signage environment. This means nobody is sitting in front of the browser window and being able to click on these annoying cookie request popups appearing on top of most webpages in Europe. For Chrome there exists a plugin called "I don’t care about […]

By Michael S
Categorized as angular, chromium, cookies, electron Tagged , , ,

Angular: (re)activate google analytics (cookies after user consented to all cookies

I added googleanalytcis js (analytics.js) to index.html of my angular app. <!– Google Analytics –> <script> (function (i, s, o, g, r, a, m) { i[‘GoogleAnalyticsObject’] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = […]

Python flask API Return the cookies but set in browser

I have an application in which the python flask API and angular frontend is used I’m able to set cookies and receive in frontend header but unable to fetch the value as shown in below images the code for python flash is as follows response.set_cookie(‘token’, secret_token, max_age=900, samesite=’Lax’) response.set_cookie(‘region’, user.MMUCode) response.headers.add(‘Access-Control-Allow-Headers’, "Origin, X-Requested-With, Content-Type, Accept, […]

1 15

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us