Luigi Cortese
Luigi Cortese

Reputation: 11131

User Authentication using Google App Engine and GWT

[Sorry for my english, i'm Italian, i'll do my best]

I'm trying to implement login functionality in my web app for users who have a google account. I'm following this guide: http://code.google.com/intl/it-IT/webtoolkit/doc/latest/tutorial/appengine.html#user .

In "LoginServiceImpl.java"

[...]
if (user != null) {
  loginInfo.setLoggedIn(true);
  loginInfo.setEmailAddress(user.getEmail());
  loginInfo.setNickname(user.getNickname());
  loginInfo.setLogoutUrl(userService.createLogoutURL(requestUri));
} else {
  loginInfo.setLoggedIn(false);
  loginInfo.setLoginUrl(userService.createLoginURL(requestUri));
}
[...]

the call to

userService.createLoginURL(requestUri);

return a string like this:

/_ah/login?continue=http%3A%2F%2F127.0.0.1%3A8888%2FGoogleAccounts.html%3Fgwt.codesvr%3D127.0.0.1%3A9997

This means that, to allow a user to login, i have to redirect him here

http://127.0.0.1:8888/_ah/login?continue=http%3A%2F%2F127.0.0.1%3A8888%2FGoogleAccounts.html%3Fgwt.codesvr%3D127.0.0.1%3A9997

but doing so, I reach a white page with a white background and a blue box:

http://img528.imageshack.us/img528/8720/formy.png

and whatever email I put in there, even a not well formed one, I am redirected to my homepage and appear to be successful logged in, having something like that

if(user != null) {
  System.out.println("email = "+user.getEmail());
  System.out.println("nickname = "+user.getNickname());
  System.out.println("userId = "+user.getUserId());
  System.out.println("FederatedIdentity = "+user.getFederatedIdentity());
  System.out.println("AuthDomain = "+user.getAuthDomain());
  System.out.println("link to logout = "+userService.createLogoutURL("http://127.0.0.1:8888/GoogleAccounts.html?gwt.codesvr=127.0.0.1:9997"));
}

resulting in

email = blablabla
nickname = blablabla
userId = 12654892720623673200
FederatedIdentity = null
AuthDomain = gmail.com
link to logout = /_ah/logout?continue=http%3A%2F%2F127.0.0.1%3A8888%2FGoogleAccounts.html%3Fgwt.codesvr%3D127.0.0.1%3A9997

I was expecting some kind of redirection to a google page that asked me to authorize the application to use my data... what am i missing? Am I doing something wrong?

Upvotes: 4

Views: 1735

Answers (1)

amithgc
amithgc

Reputation: 6245

In the Development Environment, you will just see a "Blue Box (as you said)" where you can enter any email ID to login....

But when you deploy your App in Google App Engine Server, user will be redirected to the actual google login page..

Deploy your app and try it...

Upvotes: 5

Related Questions