Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
saurabhmittal19
9 years agoExplorer | Level 3
IllegalStateException while finishFromRedirect in API v3
I am using dropbox-core-sdk version 3.0.5, and I am getting "Already Connected" while trying to authorise account (and get access token) to be associated with our application.
I am using the th...
- 9 years agoThanks! Based on that stack trace, it looks like this is actually occurring in getCurrentAccount. Can you confirm you're running on Google App Engine, and can you share your code for constructing your DbxRequestConfig and calling getCurrentAccount?
Greg-DB
Dropbox Community Moderator
9 years agoCan you post the full error/stack trace? Thanks in advance!
- saurabhmittal119 years agoNew member | Level 2
Code Snippet before authorization call
final OAuthRequest state = new OAuthRequest(); state.setXYZId(String.valueOf(XYZId)); myDAO.save(state); final DbxSessionStore csrfTokenStore = new DbxStandardSessionStore(request.getSession(true), "dropbox-auth-csrf-token"); DbxWebAuth.Request webAuthRequest = DbxWebAuth.newRequestBuilder() .withRedirectUri("http://localhost:8080/authentication-finish", csrfTokenStore).withState(state.getId().toString()) .build(); oauthUrl = this.dbxWebAuth.authorize(webAuthRequest);Code Snipper in redirection URL:
final DbxSessionStore csrfTokenStore = new DbxStandardSessionStore(request.getSession(true), "dropbox-auth-csrf-token"); final DbxAuthFinish authFinish = dbxWebAuth.finishFromRedirect("http://localhost:8080/authentication-finish", csrfTokenStore, request.getParameterMap());StackTrace:-
[INFO] java.lang.IllegalStateException: Already connected [INFO] at java.net.URLConnection.setDoOutput(URLConnection.java:909) [INFO] at com.garble.drive.utils.AppEngineHttpRequestor$Uploader.getBody(AppEngineHttpRequestor.java:129) [INFO] at com.dropbox.core.http.HttpRequestor$Uploader.upload(HttpRequestor.java:105) [INFO] at com.dropbox.core.DbxRequestUtil.startPostRaw(DbxRequestUtil.java:239) [INFO] at com.dropbox.core.v2.DbxRawClientV2$1.execute(DbxRawClientV2.java:107) [INFO] at com.dropbox.core.v2.DbxRawClientV2.executeRetriable(DbxRawClientV2.java:284) [INFO] at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:102) [INFO] at com.dropbox.core.v2.users.DbxUserUsersRequests.getCurrentAccount(DbxUserUsersRequests.java:120) [INFO] at com.garble.drive.security.oauth.provider.DropboxOauthProvider.getProfileData(DropboxOauthProvider.java:57) [INFO] at com.garble.drive.security.signup.GarbleCloudRegistration.dropboxSignInFinish(GarbleCloudRegistration.java:280) [INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [INFO] at java.lang.reflect.Method.invoke(Method.java:606) [INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:128) [INFO] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) [INFO] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) [INFO] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) [INFO] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777) [INFO] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706) [INFO] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [INFO] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) [INFO] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) [INFO] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) [INFO] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) [INFO] at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) [INFO] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) [INFO] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) [INFO] at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) [INFO] at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366) [INFO] at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349) [INFO] at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) [INFO] at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) [INFO] at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) [INFO] at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) [INFO] at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) [INFO] at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:95) [INFO] at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327) [INFO] at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126) [INFO] at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168) [INFO] at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) [INFO] at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1228) [INFO] at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011) [INFO] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955) [INFO] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) [INFO] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) [INFO] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) [INFO] at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) [INFO] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) [INFO] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) [INFO] at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) [INFO] at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186) [INFO] at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) [INFO] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) [INFO] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:134) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366) [INFO] at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349) [INFO] at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116) [INFO] at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) [INFO] at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) [INFO] at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) [INFO] at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) [INFO] at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) [INFO] at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) [INFO] at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:95) [INFO] at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) [INFO] at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:508) [INFO] at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) [INFO] at org.mortbay.jetty.Server.handle(Server.java:326) [INFO] at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) [INFO] at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) [INFO] at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) [INFO] at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) [INFO] at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) [INFO] at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) [INFO] at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
- Greg-DB9 years ago
Dropbox Community Moderator
Thanks! Based on that stack trace, it looks like this is actually occurring in getCurrentAccount. Can you confirm you're running on Google App Engine, and can you share your code for constructing your DbxRequestConfig and calling getCurrentAccount?- saurabhmittal199 years agoExplorer | Level 3
Thanks for mentioning the method where the issue is coming. And yes it is a Google Cloud project running on AppEngine. I have actually resolved the issue after debugging this getCurrentAccount() method.
And this was the code snippet which we were using for calling getCurrentAccount
String clientIdentifier = "abc/1.0"; String userLocale = Locale.getDefault().toString(); DbxRequestConfig config = new DbxRequestConfig(clientIdentifier, userLocale, AppEngineHttpRequestor.Instance); DbxClientV2 client = new DbxClientV2(config, accessToken); client.users().getCurrentAccount().getEmail();
Now I changed this to:
String clientIdentifier = "abc/1.0"; DbxRequestConfig config = new DbxRequestConfig(clientIdentifier); DbxClientV2 client = new DbxClientV2(config, accessToken); client.users().getCurrentAccount().getEmail();
And the code started working. Thanks for all the support. One last question, de we need to have this clientIdentifier as "abc/1.0" hardcoded?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!