Unable to self.redirect() to external url (trying to implement OpenID consumer)

166 views
Skip to first unread message

danil...@gmail.com

unread,
May 6, 2008, 9:23:29 PM5/6/08
to Google App Engine
Hi, App Engine people!

I'm trying to implement OpenID consumer with Google App Engine. I used
python-openid 2.x and wrote all needed adaptations for working in App
Engine (user sessions with datastore backend, datastore "store"
interface and urlfetch instead of urlopen). I tested it with developer
server and it works ok!
Than I uploaded project to Google. After trying to login with OpenID
appears page with error code 302:

<HTML><HEAD><meta http-equiv="content-type" content="text/
html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="">here</A>.
</BODY></HTML>

Afer digging my project code I detected that this error occurs while
application tries to redirect to OpenID provider. Python-openid
library successfully generates this url after some discovering. Here
it is (e.g.):

http://www.myopenid.com/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B481f790a%7D%7B5Caygw%3D%3D%7D&openid.claimed_id=http%3A%2F%2Fsgtpep.myopenid.com%2F&openid.identity=http%3A%2F%2Fsgtpep.myopenid.com%2F&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.realm=http%3A%2F%2Fadvance-wars.appspot.com%2F&openid.return_to=http%3A%2F%2Fadvance-wars.appspot.com%2Fauth%2Fopenid%2F&openid.ns.sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1&openid.sreg.optional=fullname%2Cnickname%2Cemail

Yes, it's huge. And App Engine can not redirect to this url as I sad
before. It there some restrictions on url length or something else?
When I removed SRE part of query ("&openid.ns.sreg=http%3A%2F
%2Fopenid.net%2Fextensions%2Fsreg%2F1.1&openid.sreg.optional=fullname
%2Cnickname%2Cemail") than redirecting finished well.

Thank you.

Brian Ellin

unread,
May 24, 2008, 5:48:50 PM5/24/08
to Google App Engine
I also have encountered this problem. These redirects work find in
local development, but fail on the live appengine server. I'm not
sure what happens within appengine or webapp to cause this, but I get
around it using a a meta redirect:

self.response.out.write("<html><head><meta http-equiv=\"refresh\"
content=\"0;url=%s\"></head><body></body></html>" % (redirect_url,))

Cheers,
Brian Ellin
JanRain, Inc.

On May 6, 6:23 pm, "danil.m...@gmail.com" <danil.m...@gmail.com>
wrote:
> Hi, App Engine people!
>
> I'm trying to implement OpenID consumer with Google App Engine. I used
> python-openid 2.x and wrote all needed adaptations for working in App
> Engine (user sessions with datastore backend, datastore "store"
> interface and urlfetch instead of urlopen). I tested it with developer
> server and it works ok!
> Than I uploaded project to Google. After trying to login with OpenID
> appears page with error code 302:
>
> <HTML><HEAD><meta http-equiv="content-type" content="text/
> html;charset=utf-8">
> <TITLE>302 Moved</TITLE></HEAD><BODY>
> <H1>302 Moved</H1>
> The document has moved
> <A HREF="">here</A>.
> </BODY></HTML>
>
> Afer digging my project code I detected that this error occurs while
> application tries toredirectto OpenID provider. Python-openid
> library successfully generates this url after some discovering. Here
> it is (e.g.):
>
> http://www.myopenid.com/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B...
>
> Yes, it's huge. And App Engine can notredirectto this url as I sad

ryan

unread,
May 27, 2008, 9:24:22 PM5/27/08
to Google App Engine
hi brian, danil. you're absolutely right, we do intercept some
redirects for security reasons, which breaks apps like openid
consumers and providers. this is why http://openid-provider.appspot.com/
currently fails on many consumers.

it's not a high priority, but we do plan to look into this eventually.
feel free to file an issue on the issue tracker and star it; if it
gets enough votes, that will help convince us to prioritize the fix!

btw, i'm working on a sample openid consumer app. it's deployed at
http://openid-consumer.appspot.com/, and the source is available at
http://code.google.com/p/google-app-engine-samples/source/browse/trunk/openid-consumer.
it's rough, but apart from this problem, it's fully functional.

Aral Balkan

unread,
Jun 11, 2008, 4:35:04 AM6/11/08
to Google App Engine
Hi Ryan,

Thanks for the update, I've blogged a post to gain more exposure for
this (http://aralbalkan.com/1357) and I've asked people to star issue
17 (http://code.google.com/p/googleappengine/issues/detail?id=17). Is
this the correct issue they should be starring for this?

(It appears that the conversation on that issue has come round to the
topic on this thread.)

If not, which issue should I be asking people to star?

We're _so_ close to having OpenID support on Google App Engine that I
feel this should be a very high priority for Google (i.e., the
relative work vs. what it will mean in terms of ultimate payoff is
really high!) I know that being able to implement OpenID for the
Singularity web conference application I'm building is very important
for me personally.

And thank you so much for your work in creating the consumer
application. Once we have the redirects working, that should get
developers up and running quickly to consume OpenID in their apps.

Thanks,
Aral

On May 28, 2:24 am, ryan <ryanb+appeng...@google.com> wrote:
> hi brian, danil. you're absolutely right, we do intercept some
> redirects for security reasons, which breaks apps likeopenid
> consumers and providers. this is whyhttp://openid-provider.appspot.com/
> currently fails on many consumers.
>
> it's not a high priority, but we do plan to look into this eventually.
> feel free to file an issue on the issue tracker and star it; if it
> gets enough votes, that will help convince us to prioritize the fix!
>
> btw, i'm working on a sampleopenidconsumer app. it's deployed athttp://openid-consumer.appspot.com/, and the source is available athttp://code.google.com/p/google-app-engine-samples/source/browse/trun....

ryan

unread,
Jun 11, 2008, 12:50:57 PM6/11/08
to Google App Engine
Thanks! The redirect issue is actually 404,
http://code.google.com/p/googleappengine/issues/detail?id=404. Feel
free to plug that one instead.

I've been interpreting issue 17 as a feature request to build OpenID
support into App Engine directly, either in the backend or in a Python
library we ship. As I mentioned on that issue, that's not really
necessary, since OpenID libraries can be included by app developers
with their code, As you saw, that's what we did with http://openid-provider.appspot.com/
and http://openid-consumer.appspot.com/. Once the redirect bug is fix,
those existing libraries will work with all other providers and
consumers, not just a few.

ryan

unread,
Jun 11, 2008, 12:57:07 PM6/11/08
to Google App Engine
Sorry, I misspoke. 404 is a different feature request. It looks like
there's no issue on the public issue tracker for this redirect bug.
We're definitely aware of it, but if you're still encouraging people
to star an issue, feel free to either repurpose issue 17 or create a
new one!

Ross Ridge

unread,
Jun 11, 2008, 4:13:53 PM6/11/08
to Google App Engine
ryan wrote:
> Sorry, I misspoke. 404 is a different feature request. It looks like
> there's no issue on the public issue tracker for this redirect bug.

I believe it's issue 407:

http://code.google.com/p/googleappengine/issues/detail?id=407

Ross Ridge

tudorizer

unread,
Jul 29, 2008, 9:06:46 AM7/29/08
to Google App Engine
Any updates on the fix?
I went to http://openid-consumer.appspot.com/ and tried to login with
my wordpress account and it didn't work.
Reply all
Reply to author
Forward
0 new messages