AuthSub nextURL on GAE
I am looking at http://code.google.com/intl/sv-SE/apis/gdata/docs/auth/authsub.html and http://code.google.com/intl/sv-SE/appengine/articles/java/retrieving_gdata_feeds.html.
My code looks like this to generate the URL
String nextUrl = "http://myapp.appspot.com/retrieveToken/";
String scope = "http://www.google.com/calendar/feeds/";
boolean secure = false; // set secure=true to request secure AuthSub tokens
boolean session = true;
String authSubUrl = AuthSubUtil.getRequestUrl(nextUrl, scope, secure, session);
The generated url looks like this
https://www.google.com/accounts/AuthSubRequest?next=http%3A%2F%2Fmyapp.appspot.com%2FretrieveToken%2F&scope=http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F&secure=0&session=1
Looks good.. However when i follow the URL i am told something along the lines of
"http://appspot.com"开发者_开发问答 is not registered.
(i get it in swedish :)
What could be wrong here?
It's odd because because you choosed secure = false
, so you shouldn't have to register the application (you have secure=0
in your URL). But I feel that it is an issue related to the *.appspot.com
domain, because if you change the nextUrl
to anything else, let's say "http://myapp.randomDomainHjYHBB4F.com/retrieveToken/"
, the new URL is:
https://www.google.com/accounts/AuthSubRequest?next=http%3A%2F%2Fmyapp.randomDomainHjYHBB4F.com%2FretrieveToken%2F&scope=http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F&secure=0&session=1
... and it works! Isn't it very curious?
So I can't tell you what's wrong but there is an easy workaround: you can register your application and switch to secure mode!
精彩评论