Kareem
Kareem

Reputation: 57

How to get values from cookies using angular?

I have a system on the Internet that enables me to add custom applications to it through a window within this system. When you enter this window, the user session hash will be sent to the URL of the my custom application by GET method. By default, the web server sends the following cookies when an external application link opens:

enter image description here

My question, How can I get session hash value to use it in my custom page in angular?

I tried this code but it didn't work:

import { CookieService } from 'ngx-cookie-service';
constructor(private cookieService: CookieService){}
ngOnInit(): void
 {
    console.log("Hash is : ",this.cookieService.get("session_key"));
    console.log("session_key is : ", this.cookieService.get("session_key"));
    console.log("local is : ", this.cookieService.get("locale"));
 }

But the result in console is empty. enter image description here

Upvotes: 0

Views: 1687

Answers (0)

Related Questions