3

I have tried using jcabi-github following is my code

Github github = new RtGithub("<Oauth token>");
Iterable<Repo> repo =  github.repos().iterate("");
for (Repo repo2 : repo) {
    System.out.println(repo2);
}

But this is giving error

{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)

I am trying to connect to my company's git hub account which is https://github.corp.xyz.com/

Any help?

almightyGOSU
  • 3,731
  • 6
  • 31
  • 41
Pratik
  • 952
  • 2
  • 16
  • 31
  • The message is saying bad credentials and the code is showing no credentials. The javadocs for jcabi-github don't appear to have any information about authentication either. Unless there is a good reason i'd contact the developers and ask how you would authenticate. – glend Jul 20 '15 at 08:07
  • This is the part of code which is used for authentication. Github github = new RtGithub("") Read on their website/blog that I could either pass username/password aur OAuth Token – Pratik Jul 20 '15 at 08:41
  • Try with a username/password, – glend Jul 20 '15 at 08:46
  • Have tried with username/password as well – Pratik Jul 20 '15 at 08:55
  • If you are doing repeated requests, you may have hit the throttling limit, which results in "Bad credentials" messages even if everything is fine. Wait a while and it will go away; or use a different account. – tucuxi Jul 20 '15 at 09:36

1 Answers1

2

I have done this by using https://github.com/kohsuke/github-api

Here is the code for future reference:

GitHub github = GitHub.connectToEnterprise(
                        "https://github.corp.<abc>.com/api/v3",
                        "<Oauth token>");

GHContentSearchBuilder search = github.searchContent();
GHContentSearchBuilder s = search.q(<searchkeyword>);
Pratik
  • 952
  • 2
  • 16
  • 31