开发者社区> 问答> 正文

获取access token

在java版本的demo中:
String accessToken = AuthHelper. getAccessToken() ;
但是如果在开发中,我们是通过代理上网的,会抛出:

java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy4.getCorpToken(Unknown Source)
    at com.alibaba.dingtalk.openapi.demo.auth.AuthHelper.getAccessToken(AuthHelper.java:44)
    at com.csair.excel.DemoTest.main(DemoTest.java:15)
Caused by: java.net.ConnectException: connection timed out: oapi.dingtalk.com/106.11.68.3:443
    at com.ning.http.client.providers.netty.request.NettyConnectListener.onFutureFailure(NettyConnectListener.java:133)
    at com.ning.http.client.providers.netty.request.NettyConnectListener.operationComplete(NettyConnectListener.java:145)
    at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:409)
    at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:400)
    at org.jboss.netty.channel.DefaultChannelFuture.setFailure(DefaultChannelFuture.java:362)
    at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:142)
    at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:83)
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
    at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.netty.channel.ConnectTimeoutException: connection timed out: oapi.dingtalk.com/106.11.68.3:443
    at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:139)
    ... 8 more




这个需要设置代理,但是在程序中:
类[size=; font-size: 11.3pt,11.3pt] getAccessToken:
accToken = corpConnectionService.getCorpToken(Env. CORP_ID , Env. CORP_SECRET) ;
我们如何设置自己的代理连接获得accesstoken呢?不解,请各位大神指点,谢谢!!!









展开
收起
anson_arie 2018-03-27 17:27:50 3554 0
0 条回答
写回答
取消 提交回答
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载