谷歌的AppEngine蟒蛇webapp2的会议忽略了Android应用程序的cookie [英] Google AppEngine python webapp2 session ignores cookie in Android app

查看:168
本文介绍了谷歌的AppEngine蟒蛇webapp2的会议忽略了Android应用程序的cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用webapp2的演员身份验证机制的应用引擎服务器。我既有Android和iOS版的客户端,当然的机制,以保持会话持续使用Cookie。

I have an app engine server that uses webapp2 extras auth mechanism. I have both an Android and an iOS client, and of course the mechanism uses cookies in order to keep the session going.

问题是,是,当Android客户端试图提出一个要求登录后 - 即使它发送一个cookie中的一个请求 - cookie将被忽略,会话没有恢复。当我使用的iOS客户端 - 会话成功验证。

The problem is, that the when the Android client tries to make a request after logging in - even if it sends the a request with the cookie - the cookie is ignored and the session is not recovered. When I use the iOS client - the session is verified successfully.

这是很奇怪的,我不能把我的手指上为什么出现这种情况。

This is very bizarre and I can't put my finger on why this happens.

我调试这两种情况的会议上,在这里,他们是:

I debugged the session for both cases, and here they are:

iOS的会话:

Accept: */*
Accept-Language: en-us
Content_Length: 0
Content_Type: application/x-www-form-urlencoded;charset=UTF-8
Cookie: auth="eyJfdXNlciI6WzQ2Nzg2OTY4NTQwOTM4MjQsMSwiV3FmUnFWUmxUME91TllsYnZsMWFxOSIsMTQyMzM1MzI3MCwxNDIzMzUzMjcwLCJMaW9yIFphdGxhdmkiXX0\075|1423353270|c2c7343dbb701f188c18f8b16c0fe06b794ad2d2"
Host: localhost:8081
User-Agent: PeersCards/1.0 CFNetwork/711.1.12 Darwin/14.0.0
X-Appengine-Country: ZZ
INFO     2015-02-08 17:38:55,123 user_api.py:591] Session was recovered

Android的会话:

Android session:

Content_Length: 0
Content_Type: application/x-www-form-urlencoded;charset=UTF-8
Cookie: auth=eyJfdXNlciI6WzQ2Nzg2OTY4NTQwOTM4MjQsMSwiZDBCam5Sc1lucElRTjMySWxKQ0NzZyIsMTQyMzQxOTI1MSwxNDIzNDE5MjUxLCJMaW9yIFphdGxhdmkiXX0\075|1423419251|68063593b0262fdb5c6b479457c95eb9fcc7047f
Host: 10.0.0.16:8081
User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.4.2; SM-N900 Build/KOT49H)
X-Appengine-Country: ZZ
INFO     2015-02-08 18:16:11,215 user_api.py:594] Session is not saved

任何想法?

推荐答案

我已经想通了这一点。

I've figured this out.

显然,Android的CookieManager被存储的cookie为:

Apparently, the Android CookieManager was storing the cookie as:

auth=XXXXXX

和AppEngine上期待:

And AppEngine was expecting:

auth="XXXXX…" 

它也可以在输入我放在这个问题可以看出,虽然我严重不认为这是问题。

It can also be seen in the input I've placed in the question, though I seriously didn't think that would be the issue.

我手动设置成在Android code中的cookie,并且制定出了问题。

I've set the "" manually into the cookie in the Android code, and that worked out the problem.

这篇关于谷歌的AppEngine蟒蛇webapp2的会议忽略了Android应用程序的cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆