Page 1 of 1

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

Posted: Mon Oct 27, 2014 11:13 am
by Manjeet Sharma

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


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

Posted: Mon Oct 27, 2014 6:40 pm
by Evgene Karachevtsev

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/...


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

Posted: Tue Oct 28, 2014 1:58 am
by Manjeet Sharma

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.


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

Posted: Tue Oct 28, 2014 9:57 pm
by Evgene Karachevtsev

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


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

Posted: Wed Oct 29, 2014 1:40 pm
by Brenton House

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.


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

Posted: Fri Oct 31, 2014 9:42 pm
by Evgene Karachevtsev

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?