User Authentication Using Google App Engine and GWT

[Sorry for my English, I am Italian, I will do my best)

I am trying to implement login features in my web application for users who have a google account. I follow 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)); } [...] 

call

 userService.createLoginURL(requestUri); 

returns 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 in order to allow the user to log in, 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 at the same time I get a white page with a white background and a blue border:

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

and any email address that I posted there, even not completely formed, they redirect me to my home page and seem to be logged in successfully, having something like this

 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")); } 

as a result

 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 redirecting to a google page that asked me to allow the application to use my data ... what am I missing? Am I doing something wrong?

+4
source share
1 answer

In the development environment, you will see a blue frame ( as you said ), "where you can enter any email identifier for logging in.

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

Expand the application and try it ...

+5
source

Source: https://habr.com/ru/post/1387547/


All Articles