ombalakumar / socialauth

Automatically exported from code.google.com/p/socialauth
0 stars 0 forks source link

getting "Verification code is null" error while using SocialAuth to connect to facebook #170

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.i have followed the steps mentioned at this link 
"http://code.google.com/p/socialauth/wiki/GettingStarted#Step_3._Implementation"
. i tried even with BrickRed provided auth_provider.properties file. but stilll 
faced the same error
2.i am trying it on local pc of mine by editing hosts file in system32

What is the expected output? What do you see instead?
i am getting upto following steps

INFO: Determining URL for redirection
INFO: Redirection to following URL should happen : 
https://graph.facebook.com/oauth/authorize?client_id=152190004803645&response_ty
pe=code&redirect_uri=http%3A%2F%2Fopensource.brickred.com%2Fsocialauthdemo%2Fsoc
ialAuthSuccessAction.do&scope=publish_stream,email,user_birthday,user_location
INFO: Connecting provider : facebook
INFO: Retrieving Access Token in verify response function
INFO: Verifying the authentication response from provider

after this it's failing 
What version of the product are you using? On what operating system?
i am using social auth 2.2 jar with dependency 2 jar

Please provide any additional information below.

Original issue reported on code.google.com by anil.kum...@gmail.com on 10 Apr 2012 at 12:27

Attachments:

GoogleCodeExporter commented 8 years ago
Can you please show the code where you are calling connect method.
Please make sure you are calling connect method in socialAuthSuccessAction.do 
action class.

Regards
Tarun

Original comment by tar...@brickred.com on 11 Apr 2012 at 10:41

GoogleCodeExporter commented 8 years ago
hi tarun,
i did not get the socialAuthSuccessAction.do action class  .
actually i am doing it in one file. please see my code below

public void connectFacebook() throws Exception {
        String id = "facebook";
        SocialAuthConfig config = SocialAuthConfig.getDefault();
        String propUrl = "oauth_consumer.properties";
        config.load(propUrl);

        SocialAuthManager manager = new SocialAuthManager();

        manager.setSocialAuthConfig(config);

        // String
        // successUrl="http://opensource.brickred.com/socialauthdemo/socialAuthSuccessAction.do";
        String successUrl = "http://example.com:8080/ProgrammingChamps/faces/Authenticated.jsp";
        String url = manager.getAuthenticationUrl(id, successUrl);
        HttpServletRequest request = (HttpServletRequest) FacesContext
                .getCurrentInstance().getExternalContext().getRequest();
        request.getSession(true).setAttribute("authManager", manager);  

        FacesContext.getCurrentInstance().responseComplete();
        FacesContext.getCurrentInstance().getExternalContext().redirect(url);

        ExternalContext ectx = FacesContext.getCurrentInstance()
                .getExternalContext();
        HttpServletRequest requestAfterRedirection = (HttpServletRequest) ectx.getRequest();
        HttpSession session = requestAfterRedirection.getSession(true);
        manager = (SocialAuthManager) session.getAttribute("authManager");
        AuthProvider provider =manager.connect
        (SocialAuthUtil.getRequestParametersMap(requestAfterRedirection));
        Profile p = provider.getUserProfile();
        String userName = p.getFirstName();
        System.out.println(userName);
    }

i am getting error due to 4th last line(i think).
regards
Anil Sharma

Original comment by anil.kum...@gmail.com on 11 Apr 2012 at 12:46

GoogleCodeExporter commented 8 years ago
Hi Anil

While registering the application in facebook to get application key/secret, we 
have to provide the return url which is "socialAuthSuccessAction.do" in our 
case.
As you are using our application key/secret, you will have to use same domain 
and return url to make it work.

Regards
Tarun

Original comment by tar...@brickred.com on 17 Apr 2012 at 8:38

GoogleCodeExporter commented 8 years ago
hi tarun,
thanx for contacting. actually i am done with that issue .
your website does not have any jsf implementation of brickred socialAuth.
i have given that on my blog.
so if any body else faces any problem in jsf or needs example of brickred 
implementation you can share this link with him 

http://31stdimension.blogspot.in/2012/04/how-to-connect-facebook-using-jsfjava.h
tml

regards
Anil sharma

Original comment by anil.kum...@gmail.com on 17 Apr 2012 at 4:08

GoogleCodeExporter commented 8 years ago
Hi Anil

Thanks for providing this.

Regards
Tarun

Original comment by tar...@brickred.com on 27 Apr 2012 at 8:39