Host verification fails for https://www.apis.google.com/ in spring social

62 views
Skip to first unread message

java_dude via StackOverflow

unread,
Apr 28, 2015, 6:59:59 PM4/28/15
to google-appengin...@googlegroups.com

I am encountering the same issue. My best guess. There is mismatch between HTTPs call and Certificate. This looks like more of a Google issue then Spring Social Google API issue.

Not sure how long this issue has been going on. I started working on this code yesterday.

Will open bug with Google and Spring Google Social

Filed bug with Google, and for social on Github

59:27:345 ERROR org.springframework.social.connect.web.ProviderSignInController.oauth2Callback Message=Exception while completing OAuth 2 connection: 
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://www.googleapis.com/plus/v1/people/me":Host name 'www.googleapis.com' does not match the certificate subject provided by the peer (CN=*.storage.googleapis.com, O=Google Inc, L=Mountain View, ST=California, C=US); nested exception is javax.net.ssl.SSLPeerUnverifiedException: Host name 'www.googleapis.com' does not match the certificate subject provided by the peer (CN=*.storage.googleapis.com, O=Google Inc, L=Mountain View, ST=California, C=US)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:580)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:530)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:237)
    at org.springframework.social.google.api.impl.AbstractGoogleApiOperations.getEntity(AbstractGoogleApiOperations.java:50)
    at org.springframework.social.google.api.plus.impl.PlusTemplate.getPerson(PlusTemplate.java:105)
    at org.springframework.social.google.api.plus.impl.PlusTemplate.getGoogleProfile(PlusTemplate.java:110)
    at org.springframework.social.google.connect.GoogleAdapter.fetchUserProfile(GoogleAdapter.java:51)
    at org.springframework.social.google.connect.GoogleAdapter.fetchUserProfile(GoogleAdapter.java:31)
    at org.springframework.social.google.connect.GoogleConnectionFactory.extractProviderUserId(GoogleConnectionFactory.java:37)
    at org.springframework.social.connect.support.OAuth2ConnectionFactory.createConnection(OAuth2ConnectionFactory.java:91)
    at org.springframework.social.connect.web.ConnectSupport.completeConnection(ConnectSupport.java:161)
    at org.springframework.social.connect.web.ProviderSignInController.oauth2Callback(ProviderSignInController.java:216)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)

Finally found solution to this problem.

Downgrade HttpClient to 4.3.x. There is a bug filed and resolved marked for 4.5.x https://issues.apache.org/jira/browse/HTTPCLIENT-1613

For reference - https://github.com/GabiAxel/spring-social-google/issues/67#issuecomment-97154525



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/29830594/host-verification-fails-for-https-www-apis-google-com-in-spring-social/29856578#29856578

java_dude via StackOverflow

unread,
Apr 29, 2015, 7:12:01 PM4/29/15
to google-appengin...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages