我正在使用Box-Java-Sdk。我用来获取访问令牌的身份验证方法是使用Jwt的OAuth2。当我启动服务器时第一次点击api获取访问令牌时,我收到错误代码400.错误只是第一次出现,然后代码开始正常执行而没有任何错误。以下是错误摘录:
com.box.sdk.BoxAPIException: The API returned an error code: 400
at com.box.sdk.BoxAPIResponse.<init>(BoxAPIResponse.java:70)
at com.box.sdk.BoxJSONResponse.<init>(BoxJSONResponse.java:30)
at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:435)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:221)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:196)
at com.box.sdk.BoxDeveloperEditionAPIConnection.authenticate(BoxDeveloperEditionAPIConnection.java:308)
at com.box.sdk.BoxDeveloperEditionAPIConnection.tryRestoreUsingAccessTokenCache(BoxDeveloperEditionAPIConnection.java:368)
at com.box.sdk.BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(BoxDeveloperEditionAPIConnection.java:179)
at com.box.sdk.BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(BoxDeveloperEditionAPIConnection.java:206)
at com.hubble.hubbleEngine.policyTypes.OAuth.getEnterpriseToken(OAuth.java:737)
at com.hubble.saas.api.SaaSAPI.setTokens(SaaSAPI.java:255)
at com.hubble.saas.api.SaaSAPI.setTokenIfExpired(SaaSAPI.java:233)
at com.hubble.newuilayer.daoimpl.ReportsSummaryDaoImp.getApiReportsSummaryDaoList(ReportsSummaryDaoImp.java:392)
at com.hubble.newuilayer.impls.auditcontrol.ApiReportPageImpl.forwardToJSP(ApiReportPageImpl.java:54)
at com.hubble.newuilayer.servlets.MainServlet.processRequest(MainServlet.java:147)
at com.hubble.newuilayer.servlets.MainServlet.doGet(MainServlet.java:58)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.hubble.newuilayer.filters.SecurityFilter.doFilter(SecurityFilter.java:33)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.hubble.uilayer.servlets.RedirectionFilter.doFilter(RedirectionFilter.java:111)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.hubble.newuilayer.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:106)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:213)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.filters.ExpiresFilter.doFilter(ExpiresFilter.java:1201)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:744)
在从网上阅读各种答案时,我认为这是刷新令牌的错误,但我没有使用刷新令牌,因为我没有获得刷新令牌而是获得令牌到期时间。 / p>
获取单个用户的访问令牌时也会出现错误,当我在几分钟内停止服务器并再次重新启动时会发生这种情况,因为在这种情况下访问令牌仍然有效(我将其保存在数据库中),现在当我尝试为第一个用户获取访问令牌相同的错误,然后其他用户的访问令牌正确。