Upsource integration plugin Hub oath redirect issues

Hopefully someone can help me with this...

I have the following products installed on a server (using port-based virtual hosts for a reverse proxy):

  • Hub listening on port 2222 (reverse proxy port 8000)
  • Youtrack listening on port 1111 (reverse proxy port 443)
  • Upsource listening on port 3333 (reverse proxy port 8443)

Everything works great, including youtrack integration with PyCharm. However when I try to use the Upsource integration plugin, I hit a brick wall.

I point the plugin to, and when it sends me to the hub page to sign-in, there's a redirect to "localhost:3100" in the URL. I do see that listed in the "redirect URIs" for "Upsource Plugin for IntelliJ IDEA" service. I have never configure any service to listen on that port, so the redirect obviously fails.

So my questions:

  • Where is this redirect coming from?
  • Can I change it somewhere?
  • What service should this really be pointed to?

I've tried manually changing the redirect in the browser, but nothing really seems to work.

Any help would be greatly appreciated... obviously I don't know a ton about the internals of these tools.


The same problem.

I have Upsource working on port 85. No reverse-proxy, no https, everything quite plain.

Then I start IDEA with Upsource plugin on the same host as Upsource server, so the host is definitely available.

When I click on the Upsource icon at the lower bar in IDEA, it opens an URL like "http://<hostname>:85/upsource/hub/auth/login?response_type=code&client_id=upsource-idea-plugin&redirect_uri=http:%2F%2Flocalhost:3100&scope=836a3032-6161-4a72-8622-dd297cebf100&access_type=offline" in the browser.

When login/password for Upsource user with administrator rights is entered, the login form redirects me to localhost:3100, some service started by IDEA waiting for response.

In Hub log I can see that authentication passes.

20 Dec 2018 12:32:21,751 INFO  [LoginHandlerImpl              ] [qtp1953987260-305   ] [s_type=offline&rememberMe=true] User admin [bc329508-c9e3-4d0c-bc71-b6c475e2bc4c] was logged in via Hub auth module with [username: admin, serviceId: upsource-idea-plugin]

But IDEA cannot get the confirmation and establish connection.

I switched on detailed log for this plugin and here is the output from idea.log (hostname changed for security reasons):

2018-12-20 12:47:46,949 [65542155]   INFO - lij.diagnostic.DebugLogManager - Set TRACE for the following categories: #com.jetbrains.upsource
2018-12-20 12:47:49,560 [65544766]  DEBUG - idea.authorization.AuthManager - Authorization URL: http://<hostname>:85/upsource/hub/api/rest/oauth2/auth?response_type=code&client_id=upsource-idea-plugin&scope=836a3032-6161-4a72-8622-dd297cebf100&redirect_uri=http://localhost:3100&request_credentials=required&access_type=offline
2018-12-20 12:47:51,491 [65546697]  DEBUG - rce.idea.client.hub.OAuth2Util - Performing post request: http://<hostname>:85/upsource/hub/api/rest/oauth2/token, params: {code=lEiGI5lV, grant_type=authorization_code, scope=836a3032-6161-4a72-8622-dd297cebf100, redirect_uri=http://localhost:3100}
2018-12-20 12:47:51,502 [65546708]  DEBUG - ourceAuthorizationProviderImpl - 
com.jetbrains.upsource.idea.client.hub.OAuth2Exception: Invalid HTTP response: 404

 at com.jetbrains.upsource.idea.client.hub.OAuth2Util.loadToken(
 at com.jetbrains.upsource.idea.client.hub.OAuth2CodeResponseFlow.loadToken(
 at com.jetbrains.upsource.idea.client.UpsourceAuthorizationProviderImpl$MyAuthorizationHelper.processHttpRequest(
 at com.jetbrains.upsource.idea.client.AuthorizationHelper.acceptConnection(
 at com.jetbrains.upsource.idea.client.UpsourceAuthorizationProviderImpl.acceptConnection(
 at com.jetbrains.upsource.idea.authorization.AuthManager$
 at com.jetbrains.upsource.idea.util.Util$
 at com.intellij.openapi.progress.impl.CoreProgressManager$
 at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(
 at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(
 at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(
 at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(
 at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(
 at com.intellij.openapi.progress.impl.CoreProgressManager$
 at com.intellij.openapi.application.impl.ApplicationImpl$
 at java.util.concurrent.Executors$
 at java.util.concurrent.ThreadPoolExecutor.runWorker(
 at java.util.concurrent.ThreadPoolExecutor$
2018-12-20 12:47:56,049 [65551255]   INFO - ide.actions.ShowFilePathAction -
Exit code 1

 There is nothing in the log about opening port 3100 by IDEA, but it happens.

netstat gives the following just after opening login form:

TCP               LISTENING       16488 (PID of IDEA)

and after login attempt it gives:

TCP        TIME_WAIT       0

So IDEA is able to open connection, but waits for some response in vain. Upsource thinks that login is successful, but IDEA cannot get it right.

What may be the cause?


The other way it does not work either.

When I click on "Open in IDE" link on review page, it says "An IDE did not respond. Please make sure a JetBrains IDE is running, Upsource plugin is installed, and the corresponding project is open in the IDE."


At last, we're able to repair the connection.

When connection was opened, packets were sent through proxy although localhost is in exceptions in "File"->"Settings"->"Appearance & Behavior"->"System settings"->"HTTP Proxy"->"Manual proxy configuration"->"No proxy for".

But when we include "localhost" AND explicit "<hostname>", it works.


Hope it helps.