Hello,
I am trying to implement openid based login for a web application. I am able to login succesfully, however for some reason, when I try and retrieve the session variable's data (for email id of user who logged on) I am not getting any text. I put in a if condition to check if the value is null (and then print on screen that it is a null value).
However for some reason only the title and first line of text are being printed on the page. Am I doing something wrong during initialisation of the session variable? Also, the flow is that from Login Page(HTML Form) the browser next goes to a
Java page which processes the user id and password-- This java page sends the login data to Windows Live (or whatever OPENID provider was selected by user)-- Before this java page redirects to the Windows Live page, at that stage the session variable is stored. From Windows Live auth page the browser (on successful login) goes to the second page of my web application (This is a java page that denotes login successful)...I am not able to display the email ID of user, and what is surprising is that even the plain text "Email Address" is not getting printed on screen...I hope somebody can help figure out the problem here.
Kindly take a look at the code given below and tell me where I am doing it wrong-
CODE------------------------------------------------
//initialise the session object
HttpSession session = request.getSession(true);
// get the auth provider manager from session
SocialAuthManager manager = (SocialAuthManager)session.getAttribute("authManager");
// call connect method of manager which returns the provider object.
// Pass request parameter map while calling connect method.
Map<
String, String> paramsMap = SocialAuthUtil.getRequestParametersMap(request);
AuthProvider provider = manager.connect(paramsMap);
// get profile
Profile p = provider.getUserProfile();
if(p.getEmail()==null)
out.println(" <br/><h4>Value of email ID is NULL??</h4><br/>");
else
// you can obtain profile information
out.println("<br/><br/><h4>Email Address: " + p.getEmail()+ "</h4><br/>");
----------------------END OF CODE
Thanks,
Arvind.