Nikunjpatel890 / socialauth

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

Cant able to get google contact list #127

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Untill i have used google for authentication purpose alone then there is no 
problem at all, when i tried to import google contacts. "Please call 
verifyResponse function first to get Access Token" i got up with this exception.

2. I have used permission.AUTHENTICATE_ONLY in the getAuthenticationUrl if i 
dint do that then i cant even able to receive the profile information itself.

What is the expected output? What do you see instead?
To get the list of contacts in google account

What version of the product are you using? On what operating system?
socialauth-2.0-beta2.jar ON WIN 7

Please provide any additional information below.

Even i have called the verify response function too. using 
SocialAuthUtil.getRequestParametersMap(request) as the parameter but it doesnt 
works out. 

below is my code in creating URL:

 SocialAuthConfig config = SocialAuthConfig.getDefault();

            String propUrl="oauth_consumer.properties";
               config.load(propUrl);

              SocialAuthManager manager = new SocialAuthManager();
              manager.setSocialAuthConfig(config);

              String successUrl = "http://quadrupleautomation.co.in:8080/social/SocialPrint";

              String url = manager.getAuthenticationUrl("google", successUrl,Permission.AUTHENTICATE_ONLY);

              System.out.println(url);

             HttpSession session = request.getSession(true); 
              session.setAttribute("authManager", manager);

              response.sendRedirect(url);

then this is for receiving contacts:

HttpSession session = request.getSession(true); 

            SocialAuthManager m = (SocialAuthManager)session.getAttribute("authManager");

              // call connect method of manager which returns the provider object. 
              // Pass request parameter map while calling connect method. 
               AuthProvider provider = m.connect(SocialAuthUtil.getRequestParametersMap(request));
           provider.verifyResponse(SocialAuthUtil.getRequestParametersMap(request));
              // get profile
              Profile p = provider.getUserProfile();

              String userName=p.getFirstName();
              List<Contact> contactsList = provider.getContactList();
              Iterator obj=contactsList.iterator();
              while(obj.hasNext())
              {
                  System.out.println(obj.next());
              }

exceptions i got:

org.brickred.socialauth.exception.SocialAuthException: Please call 
verifyResponse function first to get Access Token
    at org.brickred.socialauth.provider.GoogleImpl.getContactList(GoogleImpl.java:273)
    at socialServlet.SocialPrint.service(SocialPrint.java:80)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Original issue reported on code.google.com by karthike...@quadrupleindia.com on 6 Dec 2011 at 2:08

GoogleCodeExporter commented 8 years ago
Try socialauth-2.0-beta4.jar without giving any permission and let me know the 
status.

Regards
Tarun

Original comment by tar...@brickred.com on 8 Dec 2011 at 8:15

GoogleCodeExporter commented 8 years ago
Hi tarun its working perfectly now. May i kno wats the problem happened Before.

Regards,
Karthikeyan

Original comment by karthika...@gmail.com on 8 Dec 2011 at 9:06

GoogleCodeExporter commented 8 years ago
When you set permission.AUTHENTICATE_ONLY and try to call getContacts, then you 
get this error.
If you only want to use socialauth only for login purpose then you can use  
permission.AUTHENTICATE_ONLY.

Regards
Tarun

Original comment by tar...@brickred.com on 12 Dec 2011 at 2:11