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 https://xxx.xxx.xxx.xxx:8443, 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.
Please sign in to leave a comment.
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(OAuth2Util.java:72)
at com.jetbrains.upsource.idea.client.hub.OAuth2CodeResponseFlow.loadToken(OAuth2CodeResponseFlow.java:39)
at com.jetbrains.upsource.idea.client.UpsourceAuthorizationProviderImpl$MyAuthorizationHelper.processHttpRequest(UpsourceAuthorizationProviderImpl.java:237)
at com.jetbrains.upsource.idea.client.AuthorizationHelper.acceptConnection(AuthorizationHelper.java:58)
at com.jetbrains.upsource.idea.client.UpsourceAuthorizationProviderImpl.acceptConnection(UpsourceAuthorizationProviderImpl.java:93)
at com.jetbrains.upsource.idea.authorization.AuthManager$6.run(AuthManager.java:522)
at com.jetbrains.upsource.idea.util.Util$3.run(Util.java:350)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:727)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:403)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
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 0.0.0.0:3100 0.0.0.0:0 LISTENING 16488 (PID of IDEA)
and after login attempt it gives:
TCP 127.0.0.1:3100 127.0.0.1:54971 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.