News:

AbanteCart v1.4.2 is released.

Main Menu
support

not logged in?

Started by pyroxide, June 10, 2015, 07:48:19 AM

Previous topic - Next topic

pyroxide

I'm having trouble with my customer API. Immediately after getting a successful login response and parsing the token from it, the cart says that I am not logged in. I'm using version 1.2.2.

my log is attached.

pyroxide

I discovered that the test_api.php works on my web server but I am still having trouble with the login from my app.

eCommerce Core

Do you have HTTPS enabled?
Can you post exact request and response?
"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

pyroxide

using SSL

this is my log:

POSTed login form:
URL: https*
rt=a/account/login
email=my e-mail
password=password
UnityEngine.MonoBehaviour:print(Object)
<PostLogin>c__Iterator4:MoveNext() (at Assets/Scripts/RequestController.cs:791)

{"status":1,"success":"Logged in","token":"43c3ed78a8b12bc7d01f6193cd47cafe"}
UnityEngine.MonoBehaviour:print(Object)
<PostLogin>c__Iterator4:MoveNext() (at Assets/Scripts/RequestController.cs:792)

token=43c3ed78a8b12bc7d01f6193cd47cafe
UnityEngine.MonoBehaviour:print(Object)
<PostLogin>c__Iterator4:MoveNext() (at Assets/Scripts/RequestController.cs:806)

verifying still logged in..
UnityEngine.MonoBehaviour:print(Object)
<PostLogin>c__Iterator4:MoveNext() (at Assets/Scripts/RequestController.cs:814)

POSTed login form:
URL: https*
rt=a/account/login
token=43c3ed78a8b12bc7d01f6193cd47cafe
UnityEngine.MonoBehaviour:print(Object)
<PostLogin>c__Iterator4:MoveNext() (at Assets/Scripts/RequestController.cs:821)

HEADERS: STATUS=HTTP/1.1 401 Unauthorized
DATE=Thu, 11 Jun 2015 11:48:29 GMT
SERVER=Apache
X-POWERED-BY=PHP/5.3.29
EXPIRES=Thu, 19 Nov 1981 08:52:00 GMT
CACHE-CONTROL=no-store, no-cache, must-revalidate, post-check=0, pre-check=0
PRAGMA=no-cache
ACCESS-CONTROL-ALLOW-ORIGIN=
ACCESS-CONTROL-ALLOW-CREDENTIALS=true
SET-COOKIE=currency=USD; expires=Sat, 11-Jul-2015 11:48:29 GMT; path=/; domain=www.*.com
TRANSFER-ENCODING=chunked
CONTENT-TYPE=application/json

UnityEngine.Debug:Log(Object)
<PostLogin>c__Iterator4:MoveNext() (at Assets/Scripts/RequestController.cs:832)

{"status":0,"request":"unauthorized"}
UnityEngine.MonoBehaviour:print(Object)
<PostLogin>c__Iterator4:MoveNext() (at Assets/Scripts/RequestController.cs:834)

eCommerce Core

When you do login request and later you pass the token, are these both requests sent via HTTPS to the same domain?
"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

eCommerce Core

"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

pyroxide

#6
Same domain. No callback.

EDIT: The requests are being sent from either mobile devices or my home computer.

eCommerce Core

Try callback. I suspect this can be related to cross domain 
"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

pyroxide

I tried allowing cross-domain via htaccess.  Headers reflected change, but I am still getting "401 Unauthorized". Perhaps I need to change a file in the shopping cart?

I'm coding everything in C#, not JQuery or JavaScript. I have no idea if callback is even possible in this case as my parser (SimpleJSON) does not have this feature.

pyroxide

I probably just don't understand callback.

eCommerce Core

Quote from: pyroxide on June 15, 2015, 03:08:28 PM
I tried allowing cross-domain via htaccess.  Headers reflected change, but I am still getting "401 Unauthorized". Perhaps I need to change a file in the shopping cart?

I'm coding everything in C#, not JQuery or JavaScript. I have no idea if callback is even possible in this case as my parser (SimpleJSON) does not have this feature.
Probably cross-domain is not an issue here.
We need to debug this some how. You can enable debug log 5 (settings -> system)  to save to log file and run login and later access with the token. Let's see what is happening.
"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

Forum Rules Code of conduct
AbanteCart.com 2010 -