Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Not able to fetch accessToken. #248

Open
alpeshvas opened this issue Dec 19, 2018 · 10 comments
Open

Not able to fetch accessToken. #248

alpeshvas opened this issue Dec 19, 2018 · 10 comments

Comments

@alpeshvas
Copy link

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://graph.facebook.com/v2.5/me": peer not authenticated; nested exception is javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:743)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:709)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:328)
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:225)
    at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchObject(FacebookTemplate.java:220)

Getting this error while fetching object using token.

@alpeshvas alpeshvas changed the title Peer not authenticated. Not able to fetch accessToken. Dec 19, 2018
@attybro
Copy link

attybro commented Jan 7, 2019

Hello @alpeshvas, I am facing the same ("peer authentication") problem.
Have you solved the problem yet?

@lazarai
Copy link

lazarai commented Jan 12, 2019

Also curious if you managed to fix it. I'm having the same issue and can't find any leads. The funny part is, this happens only on the every other request, so one works, one doesn't. @alpeshvas

@IRus
Copy link

IRus commented Jan 14, 2019

Got same issue (unrelated to spring-social-facebook) but with facebook api:

Get on https://graph.facebook.com/?id=$url randomly fails with

javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
    at sun.security.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:526)
    at org.apache.http.nio.conn.ssl.SSLIOSessionStrategy.verifySession(SSLIOSessionStrategy.java:205)
    at org.apache.http.nio.conn.ssl.SSLIOSessionStrategy$1.verify(SSLIOSessionStrategy.java:188)
    at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:354)
    at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:503)
    at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:120)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
    at java.lang.Thread.run(Thread.java:834)

Code running in docker openjdk:11.0.1-jre-sid

@okohub
Copy link

okohub commented Jan 22, 2019

Hello guys,

There is a strange bug about this: https://bugs.openjdk.java.net/browse/JDK-8213202

Actually we did not find this through facebook login problem, we were also struggling with some other api (which is facebook merchant). Looks like its about tlsv1.3

A solution? Of course;

For now, you can add this prop to jvm. After we made this, connection problems were gone :)

-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 

Cheers! :)

@thithuhanguyen
Copy link

@attybro

Sent with GitHawk

@thithuhanguyen
Copy link


Sent with GitHawk

@thithuhanguyen
Copy link

Hà Nội

Sent with GitHawk

@emmanuelt88
Copy link

emmanuelt88 commented May 8, 2019

Hey
I'm having the same issue but with Oracle JDK as well.
I tried adding the https.protocols, I thought it was fixed with that till today that failed again after 3 days running ok and as @IRus said it fails randomly for me as well.

Any other options I could try?
Context:

  • Running on Docker with jdk-11.0.2
  • Springboot 2.1.2.RELEASE
  • Running on Amazon ECS (I tried locally and the same issue)

Any help will be really appreciated.

Thanks in advance!

@RoieBeck
Copy link

RoieBeck commented Jun 1, 2019

Hello,
this issue still happen when using spring social facebook,
the fix(https jvm flag) you offered does work, but I was wonderting when the issue will be fixed?
details:
OpenJdk 11.0.2

Spring social facebook LTS(2.0.3)
<dependency> <groupId>org.springframework.social</groupId> <artifactId>spring-social-facebook</artifactId> <version>2.0.3.RELEASE</version> </dependency>

tnx

@anatolyw
Copy link

If it is still actual for someone:
the issue is TLS related as it was mentioned by @okohub and a fix with Java VM-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 works. But the real problem is the bug in JDK 11.0.2 and nothing to do with spring-social-facebook
See here: https://bugs.openjdk.java.net/browse/JDK-8213202
You have to upgrade your JDK.
Note for macOS users:
if you use brew for java installation (ex: brew cask install java11),
it still installs openjdk-11.0.2.jdk (on the moment of writing this reply).
Use the one from adoptopenjdk (install it manually with .pkg file): https://adoptopenjdk.net/index.html?variant=openjdk11&jvmVariant=hotspot
Tested with v11.0.6 the problem has gone!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

9 participants