Tuesday, March 27, 2012

Re: GMail authentication with GWT + GAE - works in development but fails in production

Any help pls. i am still stuck with it.

On Mon, Mar 26, 2012 at 10:11 PM, Deepak Singh <deepaksingh.kr@gmail.com> wrote:
Hi All,

I am authenticating my users through GMail login in GWt + GAE environment. Code is as follows:

GWT code:

final Frame frameForGmail = new Frame();
final Image gmailIcon = Image.wrap(Document.get().getElementById("gmailIcon"));
final DialogBox loginPopUp = new DialogBox(true, false);


gmailIcon.addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
commonRpcService.gmailLogin(new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
Window.alert("RPC Failed");
}
@Override
public void onSuccess(String result) {
if(emailValidation(result)) {
Document.get().getElementById("loginMsg").appendChild(new Label("Welcome "+result).getElement());
}else {
frameForGmail.setUrl(result);
loginPopUp.show();
}
}
});
}
});


Server side:

@Override
public String gmailLogin() {
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if(user != null) {
HttpSession session = getThreadLocalRequest().getSession(true);
session.setAttribute("LOGGED_IN_USER_EMAIL_ID", user.getEmail());
return user.getEmail();
}else {
try {
                  // getThreadLocalResponse().sendRedirect(userService.createLoginURL(getThreadLocalRequest().getRequestURI()));
return userService.createLoginURL("www.yatrafinder.com");
} catch (Exception e) {
System.out.println("CommonRpcServiceImpl.gmailLogin() "+e.getMessage());
}
}
return "Login not validated";
}


The above code works fine in development mode. It loads Frame with default login screen for development and works fine everything.

But when i deploy this app to GAE 1.6.1, it fails to load the frame with gmail login screen. The DialogBox opens but with blank screen.
I could not find out why it is happening. Kindly help.

App engine settings is done properly with default authentication as google account.




Thanks in advance 
Deepak Singh



--
Deepak Singh

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment