Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotmail login with NullPointerException #14

Closed
GoogleCodeExporter opened this issue Dec 3, 2015 · 2 comments
Closed

Hotmail login with NullPointerException #14

GoogleCodeExporter opened this issue Dec 3, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Hi

thanks for your great opensource work: socialauth 

here is my problem:

i’m trying socialauth project to login via hotmail account, everything ok 
before return back from hotmail

i can see the parameters hotmail has passed to my url

but when invoke this code (below)

Profile p = provider.verifyResponse(request);

i get an exception , the stack is:

java.lang.NullPointerException
    at org.brickred.socialauth.provider.HotmailImpl.verifyResponse(HotmailImpl.java:96)
    at org.apache.jsp.test.openid_jsp._jspService(openid_jsp.java:61)


why this exception happy, can you give me some suggestions ?

my website http://www.oschina.net is now using jopenid , but it only support 
gmail and yahoo, if socialauth passed my test, it’s perfect !

BTW: i try your demo http://opensource.brickred.com/socialauthdemo/
login ok,but nothing display in the success page.


Winter Lau
ld@oschina.net

Original issue reported on code.google.com by oschina....@gmail.com on 10 Nov 2010 at 8:44

@GoogleCodeExporter
Copy link
Author

Hi

It seems you are not getting provider object from session in return action.

Please have a look the code given below:-

Suppose in first java action you are writing this code:-

AuthProvider provider = AuthProviderFactory.getInstance(“hotmail”);
            String returnToUrl = "http://opensource.brickred.com/socialauthdemo/socialAuthSuccessAction.do"; (Change it with your return URL)
            HttpSession session = request.getSession();
            Session.setAttribute(“provider”,provider);
            String url = provider.getLoginRedirectURL(returnToUrl);
            //..your code to forward it to url.

In success action get the provider from session:-


HttpSession session = request.getSession();
AuthProvider provider = null;
            If(Session.getAttribute(“provider”)!=null){
                  provider = (AuthProvider)session.getAttribute(“provider”);
}
if (provider != null) {
Profile profile = provider.verifyResponse(request);
//….rest of code
            }

 I am attaching my struts action files also for your reference. In struts action I am using form bean to store provider object in session. But in above example I am setting provider in session directly. So if you are not using struts you can use above code.

OR you can go through the following link for complete understanding of struts 
demo.
http://code.google.com/p/socialauth/wiki/StrutsSample


I hope it will help you to resolve your problem. If you are still facing same 
issue , please send me your complete code of these actions.

Regards
Tarun

Original comment by tar...@brickred.com on 10 Nov 2010 at 12:52

@GoogleCodeExporter
Copy link
Author

Original comment by tsg.bric...@gmail.com on 8 Dec 2010 at 3:19

  • Changed state: Done
  • Added labels: Type-Task
  • Removed labels: Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant