谷歌电子表格有问题:授权。通过 oauth2callback 时收到的确切错误如下... 500 服务器错误。消息 - 无法获取访问令牌。
本地开发环境:
- 骡子 ESB 3.9
- JDK 1.8_161
- 谷歌电子表格连接器 1.2.4
http://localhost:3000/oauth2callback?state= some_generated_state_value &code= some_generated_code
<google-spreadsheets:config-with-oauth name="Google_Spreadsheets" consumerKey="${google.apiKey}" consumerSecret="${google.apiSecret}" doc:name="Google Spreadsheets">
<google-spreadsheets:oauth-callback-config domain="localhost" localPort="3000" remotePort="3000" path="oauth2callback"/>
</google-spreadsheets:config-with-oauth>
<flow name="authorizationAndAuthenticationFlow">
<http:listener config-ref="httpListenerConfig" path="${google.api}/oauth-authorize" allowedMethods="GET" doc:name="HTTP" >
</http:listener>
<google-spreadsheets:authorize config-ref="Google_Spreadsheets" accessTokenUrl="https://accounts.google.com/o/oauth2/token" authorizationUrl="https://accounts.google.com/o/oauth2/auth" doc:name="Google Spreadsheets"/>
<logger message="Google has authorized the connector." level="INFO" doc:name="Logger: Log Google authorization"/>
<set-payload value="You have successfully authorized the connector" doc:name="Set Payload"/>
</flow>
确切的堆栈跟踪错误如下...
ERROR 2018-02-08 19:35:25,195 [[app-google].auto-generated-listener-config-0.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Unable to fetch access token.
Payload : {NullPayload}
Payload Type : org.mule.transport.NullPayload
Element : /DynamicFlow-localhost:3000\/oauth2callback/processors/0/1 @ app-google
--------------------------------------------------------------------------------
Root Exception stack trace:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
at sun.security.validator.Validator.validate(Validator.java:260)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1596)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:987)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1334)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1309)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:259)
at org.mule.security.oauth.util.HttpUtilImpl.post(HttpUtilImpl.java:72)
有关如何解决此问题的任何想法。我不确定这是连接器源代码问题还是 Google 可能会在 v4 中更改其 OAUTH2 API 实现的问题。无论哪种方式,堆栈跟踪似乎都与 TLS 证书问题有关。也许需要提供 google api 证书,所以关于如何注入应用程序或 JVM 使用的信任库以通过此证书问题的任何想法?