moreiracruz / facebook-java-api

Automatically exported from code.google.com/p/facebook-java-api
0 stars 0 forks source link

Authentication fails #115

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Just starting with basic authentication, example taken from here:
http://straylink.wordpress.com/2008/06/03/logging-in-with-facebook-java-api/

What is the expected output? What do you see instead?
User logged in, session key properly returned to client.

Instead it fails (users did successfully logged in and application was allowed):
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: 
No name matching 
api.new.facebook.com found
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate
(ClientHandshaker.java:975)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage
(ClientHandshaker.java:123)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake
(SSLSocketImpl.java:1096)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake
(SSLSocketImpl.java:1123)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake
(SSLSocketImpl.java:1107)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:405)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:166)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect
(HttpsURLConnectionImpl.java:133)
    at com.google.code.facebookapi.ExtensibleClient.postRequest
(ExtensibleClient.java:1507)
    at com.google.code.facebookapi.ExtensibleClient.callMethod(ExtensibleClient.java:859)
    at com.google.code.facebookapi.ExtensibleClient.callMethod(ExtensibleClient.java:666)
    at com.google.code.facebookapi.FacebookXmlRestClient.auth_getSession
(FacebookXmlRestClient.java:182)
    at si.marand.Funambol.Services.ServiceImplFacebook.<init>
(ServiceImplFacebook.java:62)
    at si.marand.Funambol.Services.TestServiceFB.main(TestServiceFB.java:6)
Caused by: java.security.cert.CertificateException: No name matching 
api.new.facebook.com 
found
    at sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:210)
    at sun.security.util.HostnameChecker.match(HostnameChecker.java:77)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkIdentity
(X509TrustManagerImpl.java:264)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted
(X509TrustManagerImpl.java:250)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate
(ClientHandshaker.java:954)
    ... 16 more
Session key is null
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Long.parseLong(Long.java:424)
    at java.lang.Long.parseLong(Long.java:461)
    at com.google.code.facebookapi.FacebookXmlRestClient.extractLong
(FacebookXmlRestClient.java:254)
    at com.google.code.facebookapi.FacebookXmlRestClient.extractLong
(FacebookXmlRestClient.java:67)
    at com.google.code.facebookapi.ExtensibleClient.users_getLoggedInUser
(ExtensibleClient.java:965)
    at si.marand.Funambol.Services.ServiceImplFacebook.<init>
(ServiceImplFacebook.java:75)
    at si.marand.Funambol.Services.TestServiceFB.main(TestServiceFB.java:6)

What version of the product are you using? On what operating system?
Using stable 2.0.1 and tried also latest trunk, linux with java 1.6 (tried with 
both Sun and OpenJDK)

Please provide any additional information below.

Original issue reported on code.google.com by kristjan...@gmail.com on 7 Oct 2008 at 8:12

GoogleCodeExporter commented 8 years ago
I was able to reproduce this and noticed the exception is thrown at this line:
String session = client.auth_getSession(token);

However, I am not versed in developing for a Desktop application.

I did notice in FaceBookRestClient though, that this line is setting the call 
to use
SSL when using a Desktop app and the AUTH_GET_SESSION method:
boolean doHttps = isDesktop() && FacebookMethod.AUTH_GET_SESSION.equals( method 
);

Original comment by hahna...@gmail.com on 8 Oct 2008 at 3:01

GoogleCodeExporter commented 8 years ago
The fix is to change api.new.facebook.com to api.facebook.com, since the 
migration 
to the new profile is complete.

Original comment by hahna...@gmail.com on 21 Oct 2008 at 5:45

GoogleCodeExporter commented 8 years ago
fixed (2.0.2-SNAPSHOT)

Original comment by fern...@gmail.com on 22 Oct 2008 at 5:32