Hi Nick Johnson

Sorry for the late reply. I did not get time to investigate again on
this.

Today I tested the same scenario with the following sample code:

from google.appengine.ext import webapp
from google.appengine.api import users
import random

# attached to '/test/home.htm'
class GoogleLoginUrlGeneratorHandler(webapp.RequestHandler):
    def get(self):
        rand_number = str(random.randrange(0, 9999))
        self.response.out.write('Number: ' + rand_number)
        self.response.out.write('<a href="' + users.create_login_url('/
test/login.htm?number=') + rand_number + '">Google Sign In</a>')

# attached to '/test/login.htm'
class GoogleLoginReturnHandler(webapp.RequestHandler):
    def get(self):
        google_user = users.get_current_user()
        num_param = self.request.get('number')

        if google_user:
            self.response.out.write('Welcome ' +
google_user.nickname())
            self.response.out.write('<br>Number param received: ' +
num_param)
            self.response.out.write('<a href="' +
users.create_logout_url('/test/home.htm') + '">Sign Out</a>')
        else:
            self.response.out.write('Ooops. No google user signed in.
Please sign in using link given at <a href="/test/home.htm"> Home page
</a>')

It is working fine now!! :) :P . (I even tried to use a randomly
generated string in the continue url to fake google servers to choose
a different server while returning back, so as to closely resemble my
production issue! :( )

But as far as I can remember, the error that I got in my production
code was not due to a cache issue, as I was checking the logs time and
again while debugging the issue.

As I do not have a proof of the logs, I assume that it might be due to
cache issue and so you can close this discussion.

But in case me or some one else faces the same problem again (maybe
when App Engine feels sick ;)), we can take this issue up.

Thanks and Regards
Jagan

On Jun 15, 9:51 pm, "Nick Johnson (Google)" <[email protected]>
wrote:
> Hi Jagan,
>
> Are you sure this isn't a caching issue? It's likely that the user's browser
> is returning the pre-login page to the user from cache, even after they've
> logged in.
>
> You can verify this by checking your logs to see if a new request was made,
> or by including a timestamp in the page.
>
> -Nick Johnson
>
>
>
>
>
> On Tue, Jun 15, 2010 at 9:22 AM, Jagan <[email protected]> wrote:
> > Hi all
>
> > I had to spend 2 days to figure out a strange problem relating to
> > using Google Users service.
>
> > Problem: I recently enabled Google Accounts sign in in my app. But in
> > production, when someone signs in with their Google account, the
> > landing page (/trees/list.htm in my case) after the sign in returned
> > None (null) for the users.get_current_user(), in Python. I think this
> > problem would exist in Java world as well. Strangely, if I hit the
> > landing page after 5 to 10 min in the same browser page, the function
> > returned the signed in Google user!!
>
> > Solution: I figured that this happens when the landing (redirect) page
> > given to Google is *different* from the page that redirects or
> > generates the link to the Google sign in page (/login.htm in my case),
> > this 5 to 10 min of delay occurs when the users.get_current_user() api
> > returns the signed in Google user. When I am instructing Google to
> > redirect to the same page (login.htm) that generated the link to the
> > Google sign page, this bug was solved.
>
> > Possible explanation by me: It might be due to something like sticky
> > sessions, in which the cloud server that generated the Google Login
> > URL sees the signed up user instantly than the other servers in the
> > cloud. So when the landing page is different from this URL, the
> > request goes to some other machine in the cloud, where it takes 5 to
> > 10 min for the data of Google user signed-in to be propagated!!
>
> > Thoughts?
>
> > --
> > Jagan
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine%2Bunsubscrib 
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.
>
> --
> Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd. ::
> Registered in Dublin, Ireland, Registration Number: 368047
> Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
> 368047

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to