Manjeet Sharma
Posts: 0
Joined: Tue Jul 22, 2014 7:50 am

Session ID from Login API response is not accessible on android phones

Hi,

In my application, I am accessing the shopper session id cookie which is part of the login API response header. This I am accessing from loginAPI-complete event by following code:

var cookies =jqXHR.getResponseHeader('Set-Cookie');
var ShopperSessionId = getCookie("SessionId");
localStorage.setItem("ShopperSessionId", ShopperSessionId);
function getCookie(cname) {
var name = cname + "=";
var ca = cookies.split(';');
for(var i=0; it know why this is behaving like this.

Please help me in fetching the cookies from API response on android phones.

Thanks,
Manjeet

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Session ID from Login API response is not accessible on android phones

Hello,

You can't get someone else (from another domain) cookies. But you can make a request to this third-party domain sending cookies in the request
https://getsatisfaction.com/apperyio/...

Manjeet Sharma
Posts: 0
Joined: Tue Jul 22, 2014 7:50 am

Session ID from Login API response is not accessible on android phones

Hey I am able read the cookie on IOS devices.But on android not able to read. And yes I am making the service call by making withCredential to true.
Still I am not able to fetch cookie from
Jqxhr in the complete event of login API response.Please suggest help me in this.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Session ID from Login API response is not accessible on android phones

Manjeet,

According to the specification you can't get the Set-Cookie header using getResponseHeader, please see
http://www.w3.org/TR/XMLHttpRequest/#...
pre3. If header is a case-insensitive match for a Set-Cookie or Set-Cookie2, return null./pre
Similarly with getAllResponseHeaders http://www.w3.org/TR/XMLHttpRequest/#...
So either there is some bug in iOS, but there isn't it in Android, or we don't understand each other, but in theory you should not be able to get them

Brenton House
Posts: 0
Joined: Thu Feb 27, 2014 4:12 am

Session ID from Login API response is not accessible on android phones

This should not be a cross domain issue. We are calling our site directly from the phone. The call is working while we are logged in, but when we kill the app, we lose our cookie. We should have access to the cookie.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Session ID from Login API response is not accessible on android phones

Hello Brenton,

Sorry for delay, but I'm not sure I understand you correctly.
[quote:]We are calling our site directly from the phone[/quote]
Could you please clarify, what does it mean "directly from the phone"? Where do you open the site or cause it and how do you do it?
Could you please provide us with step-be-step instruction of what do you do and what do you do for it stop to work?

Return to “Issues”