OussamaOBO / socialauth

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

Connectivity with facebook is not working for me. #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying socialauth with facebook and it is not working.

Following could be the reasons:
On the link given for facebook, I have added my domain url everything. 

It added an application in app.facebook.com and I have got three things:
Application ID
API Key
Application Secret

Now in the oauth_consumer.properties, 
graph.facebook.com.consumer_key should be (Application ID or API Key)?
I tried with both and it ain't working. 

Facebook is showing me the application home page where 
directory status:Not Submitted, Do I need to submit it first. 
While submitting it says application should have more than 5 users. 
Does t need to be completed first.

While adding my domain, facebook asked for terms and conditions page and 
policies page which I have not created yet. Could that be the issue?

In my server logs, I can't see any logs. 

I am sorry I am bugging you guys with own development issues. But I am not 
getting help from anywhere else.

Please suggest.

Original issue reported on code.google.com by lovelyvi...@gmail.com on 18 Nov 2010 at 7:36

GoogleCodeExporter commented 9 years ago
Hi,

I just successfully implemented facebook on localhost.

1.Are you testing on localhost or the actual site?
2.What is the 'Site URL' you have specified to facebook?
3.What error are u getting? (I did get errors from facebook in json format 
initially)

Its working for me without 'submitting application to directory'.
The site URL I have specified is http://localhost:8080/socialauth
(for now)
Its working.

The main initial problem for me was specifying correct 'site URL'....

Regards,
Yudhajit

Original comment by cosmic...@gmail.com on 18 Nov 2010 at 8:52

GoogleCodeExporter commented 9 years ago
Hi

Please check the following:-

1)Consumer key should be application Id.
2)Only SiteURL is necessary while creating application on facebook as shown in 
the attached image.
3)Return URL should start with site URL e.g
  if your site URL is - http://localhost:8080/socialauthdemo
  then return URL should be - 
   http://localhost:8080/socialauthdemo/socialAuthSuccessAction.do 
   or
   http://localhost:8080/socialauthdemo/[your action..]
4)In redirect action set the provider object in session and in success action 
take the provider object from session as I have mentioned in the following 
issue.
http://code.google.com/p/socialauth/issues/detail?id=14&can=1

Regards
Tarun

Original comment by tar...@brickred.com on 18 Nov 2010 at 9:30

Attachments:

GoogleCodeExporter commented 9 years ago
I am testing on the actual site.

Site URL specified in facebook is: http://hurrah.co.in/socialauthdemo/
Site domain:hurrah.co.in

I get the following text on the browser:
{
   "error": {
      "type": "OAuthException",
      "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration."
   }
}
and in logs : Null Ponter Exception

What should be the value of 
graph.facebook.com.consumer_key 
Application ID or API Key ?

Thanks

Original comment by vikas.si...@gmail.com on 18 Nov 2010 at 9:43

GoogleCodeExporter commented 9 years ago
Sorry, I did not read your comment. I will try the above first.

Original comment by vikas.si...@gmail.com on 18 Nov 2010 at 9:47

GoogleCodeExporter commented 9 years ago
I am trying consumer key as Application Id. Follwing is getting printed on 
server logs:
15:55:09,500 INFO  [STDOUT] </log>
15:55:39,125 INFO  [SocialAuthenticationAction] Redirecting to: 
https://graph.facebook.com/oauth/authorize?client_id=133771453342844&display=pag
e&redi
rect_uri=http://192.168.100.211/socialauthdemo/socialAuthSuccessAction.do&scope=
publish_stream,email,user_birthday,user_location

I think my returnToURL and provider thing is correct. Because it is working 
fine with twitter and yahoo. I am able to get yahoo contact list.

Original comment by vikas.si...@gmail.com on 18 Nov 2010 at 10:30

GoogleCodeExporter commented 9 years ago
Hi Vikas

Are you able to see facebook login page when your action redirects to you on 
facebook, if you are not already logged-in on facebook.
Can you please send me your action files and snapshot of facebook application 
page as I have attached in my previous comment.

Regards
Tarun

Original comment by tar...@brickred.com on 18 Nov 2010 at 10:40

GoogleCodeExporter commented 9 years ago
Hi
No, I am not even able to see the facebook login page.
I see the error page which is also attached wth the comment.

Original comment by lovelyvi...@gmail.com on 18 Nov 2010 at 11:09

Attachments:

GoogleCodeExporter commented 9 years ago
These are the action files. 
Almost the which were provided except the URL.

Original comment by lovelyvi...@gmail.com on 18 Nov 2010 at 11:15

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Vikas

As per the facebook error image it seems your return URL is not correct as it 
is also viewing in facebook error page address bar.

redirect_uri=http://192.168.100.211/socialauthdemo/socialAuthSuccessAction.do&sc
ope=publish_stream,email,user_birthday,user_location

This is because in SocialAuthenticationAction.java file you have written

 String returnToUrl = RequestUtils.absoluteURL(request,"/socialAuthSuccessAction.do").toString();

This is giving you the actual URL(IP). This happens if you are using virtual 
host to map your application may be.

So try once by writing complete URL in SocialAuthenticationAction.java.
String returnToUrl = 
"http://hurrah.co.in/socialauthdemo/socialAuthSuccessAction.do";

And check your log after that,it will be like that

15:55:39,125 INFO  [SocialAuthenticationAction] Redirecting to: 
https://graph.facebook.com/oauth/authorize?client_id=133771453342844&display=pag
e&redirect_uri=http://hurrah.co.in/socialauthdemo/socialAuthSuccessAction.do&sco
pe=publish_stream,email,user_birthday,user_location

Original comment by tar...@brickred.com on 18 Nov 2010 at 12:42

GoogleCodeExporter commented 9 years ago
Actually 192.168.100.211 is the internal IP of the server where I am running 
the code.
So after giving the complete URL, I need to make it checked from external 
IP(outside my office). Because I cannot access it by www.hurraah.co.in from my 
office. I have to give internal IP.

I thought the same thing and tried giving 
http://192.168.100.211/socialauthdemo/socialAuthSuccessAction.do (thought it 
work from inside office). But that didn't work also.

Anyway I will try it giving 
http://hurraah.co.in/socialauthdemo/socialAuthSuccessAction.do and will check 
from outside.

Thanks

Original comment by lovelyvi...@gmail.com on 18 Nov 2010 at 1:03

GoogleCodeExporter commented 9 years ago
Hi

Okay!! There is something positive this time :)

I gave the complete URL and I told my friend to try it and he can see profile 
page and still contact list is empty. Still Attached is the screen-shot.

18:43:56,468 INFO  [SocialAuthenticationAction] Into if: facebook
18:43:56,484 INFO  [SocialAuthenticationAction] Redirecting to: 
https://graph.facebook.com/oauth/authorize?client_id=133771453342844&display=pag
e&redi
rect_uri=http://hurraah.co.in/socialauthdemo/socialAuthSuccessAction.do&scope=pu
blish_stream,email,user_birthday,user_location

18:46:41,625 INFO  [SocialAuthSuccessAction] Socialauthseccessaction ---- 
provider: org.brickred.socialauth.provider.FacebookImpl@7ab89d
18:46:41,625 WARN  [RequestProcessor] Unhandled Exception thrown: class 
java.lang.NullPointerException
18:46:41,625 ERROR [[action]] Servlet.service() for servlet action threw 
exception
java.lang.NullPointerException
        at com.auth.actions.SocialAuthSuccessAction.execute(SocialAuthSuccessAction.java:100)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
        at java.lang.Thread.run(Thread.java:662)
18:50:29,640 INFO  [SocialAuthSuccessAction] Socialauthseccessaction ---- 
provider: org.brickred.socialauth.provider.FacebookImpl@7ab89d

Still no contact-list. 

and don't you think relative URL should work because after giving the complete 
URL I can see the login page and allow page. But not the final page showing 
profile info and empty contactlist. Because I cannot access www.hurraah.co.in 
from inside. I have to access it using internal IP. 

Original comment by lovelyvi...@gmail.com on 18 Nov 2010 at 1:36

Attachments:

GoogleCodeExporter commented 9 years ago
The issue is that both the accessToken and authCode need to be encoded in the 
url before been sent to facebook. See the updated FaceboookImpl.java

Original comment by alangi...@gmail.com on 26 Nov 2010 at 4:55

Attachments:

GoogleCodeExporter commented 9 years ago
I have the made the changes in FacebookImpl.java. 
But I think jar needs to be updated.

Original comment by lovelyvi...@gmail.com on 30 Nov 2010 at 2:33

GoogleCodeExporter commented 9 years ago
That is surprising. Can you please test out our demo ? Because in that 
implementation we do not encode the accessToken and authCode and it seems to 
have worked.

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

GoogleCodeExporter commented 9 years ago

Original comment by abhinavm...@gtempaccount.com on 27 Dec 2010 at 11:07