GitLabProjects icon indicating copy to clipboard operation
GitLabProjects copied to clipboard

"Share on Gitlab" feature not listing namespace, fails on "Refresh groups" and "Share"

Open sidx64 opened this issue 6 years ago • 2 comments

Hello!

I am running on the latest version of PyCharm and GitLabProjects Plugin, and I am unable to share a project on Gitlab, which was created on my local machine. I am using a provate GitLab CE Server.

Steps to reproduce issue:

  1. Create a new Django Project in PyCharm
  2. Click on "VCS" > "Import into Version Control" > "Share on GitLab"
  3. Fill Project Name
  4. Click on the refresh icon in the groups section which has a tooltip "Resfresh Groups" [Note that the tooltip has a typo : Resfresh]

At this point, an error pops up:

org.gitlab.api.GitlabAPIException: {"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}
java.lang.Error: org.gitlab.api.GitlabAPIException: {"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}
	at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:239)
	at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:193)
	at org.gitlab.api.http.GitlabHTTPRequestor.getAll(GitlabHTTPRequestor.java:161)
	at com.ppolivka.gitlabprojects.api.ApiFacade.getNamespaces(ApiFacade.java:51)
	at com.ppolivka.gitlabprojects.share.GitLabShareDialog$3.run(GitLabShareDialog.java:124)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
	at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
	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)
Caused by: org.gitlab.api.GitlabAPIException: {"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}
	at org.gitlab.api.http.GitlabHTTPRequestor.handleAPIError(GitlabHTTPRequestor.java:369)
	at org.gitlab.api.http.GitlabHTTPRequestor.access$300(GitlabHTTPRequestor.java:28)
	at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:236)
	... 17 more
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://gitfinity.cerner.com/api/v3/namespaces?private_token=kfJvfRPMyTsNW-hhnuu_
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:324)
	at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:28)
	at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:232)
	... 17 more


java.lang.Error: org.gitlab.api.GitlabAPIException: {"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}
	at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:239)
	at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:193)
	at org.gitlab.api.http.GitlabHTTPRequestor.getAll(GitlabHTTPRequestor.java:161)
	at com.ppolivka.gitlabprojects.api.ApiFacade.getNamespaces(ApiFacade.java:51)
	at com.ppolivka.gitlabprojects.share.GitLabShareDialog$3.run(GitLabShareDialog.java:124)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
	at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
	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)
Caused by: org.gitlab.api.GitlabAPIException: {"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}
	at org.gitlab.api.http.GitlabHTTPRequestor.handleAPIError(GitlabHTTPRequestor.java:369)
	at org.gitlab.api.http.GitlabHTTPRequestor.access$300(GitlabHTTPRequestor.java:28)
	at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:236)
	... 17 more
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://gitfinity.cerner.com/api/v3/namespaces?private_token=kfJvfRPMyTsNW-hhnuu_
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:324)
	at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:28)
	at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:232)
	... 17 more
  1. Click on Share button This too, creates the same exception:
org.gitlab.api.GitlabAPIException: {"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}
java.lang.Error: org.gitlab.api.GitlabAPIException: {"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}
	at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:239)
	at org.gitlab.api.http.GitlabHTTPRequestor$1.hasNext(GitlabHTTPRequestor.java:193)
	at org.gitlab.api.http.GitlabHTTPRequestor.getAll(GitlabHTTPRequestor.java:161)
	at com.ppolivka.gitlabprojects.api.ApiFacade.getNamespaces(ApiFacade.java:51)
	at com.ppolivka.gitlabprojects.share.GitLabShareDialog$3.run(GitLabShareDialog.java:124)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
	at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
	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)
Caused by: org.gitlab.api.GitlabAPIException: {"error":"invalid_token","error_description":"Token was revoked. You have to re-authorize from the user."}
	at org.gitlab.api.http.GitlabHTTPRequestor.handleAPIError(GitlabHTTPRequestor.java:369)
	at org.gitlab.api.http.GitlabHTTPRequestor.access$300(GitlabHTTPRequestor.java:28)
	at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:236)
	... 17 more
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://gitfinity.cerner.com/api/v3/namespaces?private_token=kfJvfRPMyTsNW-hhnuu_
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at org.gitlab.api.http.GitlabHTTPRequestor.parse(GitlabHTTPRequestor.java:324)
	at org.gitlab.api.http.GitlabHTTPRequestor.access$200(GitlabHTTPRequestor.java:28)
	at org.gitlab.api.http.GitlabHTTPRequestor$1.fetch(GitlabHTTPRequestor.java:232)
	... 17 more

Note:

  1. I am using GitLab personal token.
  2. The token has all permissions [Read, Sudo, API] that can possibly be given from GitLab Server.
  3. I am successfully able to use the same token to clone projects from the GitLab Host server.
  4. I am successfully able to Push to remote, Pull from remote, commit changes to my local repo on all projects that I have cloned from GitLab.

I hope I have provided as many details as possible. Please let me know if there's anything else I need to provide, or if this is not an issue, and I am doing something wrong.

Thank you for the plugin. It has been immensely helpful!

sidx64 avatar May 01 '18 21:05 sidx64

Hi, tokens are not used for pushing, cloning, pulling by the plugin. I use it only for API actions. Can you try it on some API actions in postman or something like that? https://docs.gitlab.com/ee/api/

From what I can see in the logs your gitlab server will not authenticate you with the token you provided, not sure how I should replicate this.

PavlikPolivka avatar May 07 '18 08:05 PavlikPolivka

Hi,

is it possible that you were running the version of gitlab that removed the support of v3 api? If so this is what would happen. I released new version that should have this fix, maybe it will help you as well.

PavlikPolivka avatar Jun 11 '18 16:06 PavlikPolivka