nicokosi / hubstats

๐Ÿงช Command-line for GitHub pull request statistics
5 stars 0 forks source link

Update token instructions #8

Closed fbiville closed 7 years ago

fbiville commented 7 years ago

I'm not quite sure yet, but I personally use 2-factor authentication and I had to generate an access token for https://github.com/fbiville/liquigraph, a public repository.

Can you try on Liquigraph as well @nicokosi in order to see if the same thing happens?

In any case, the instructions will need to be updated, either to say: "if the project owner is an individual and uses 2-factor auth..." or "if you are using 2-factor auth..." .

nicokosi commented 7 years ago

OK, I'll have a look, thanks! ๐Ÿ‘ PS : I also use 2-factor authentication.

nicokosi commented 7 years ago

You're right: token is also required for public repos if using 2-factor authentication :

lein run --organization fbiville --repository liquigraph --token $token

returns:

pull requests for fbiville/liquigraph ->
    since 1 week(s):
        2 opened / 16 commented / 0 closed
        opened per author: {"geld0r" 1, "fbiville" 1}
        commented per author: {"fbiville" 16}
        closed per author: {}

But :

lein run --organization fbiville --repository liquigraph

fails :

Exception in thread "main" clojure.lang.ExceptionInfo: clj-http: status 401 {:status 401, :headers {"Access-Control-Expose-Headers" "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Server" "GitHub.com", "Content-Type" "application/json; charset=utf-8", "Access-Control-Allow-Origin" "*", "X-Content-Type-Options" "nosniff", "Content-Length" "83", "X-Frame-Options" "deny", "Strict-Transport-Security" "max-age=31536000; includeSubdomains; preload", "X-RateLimit-Limit" "60", "X-RateLimit-Remaining" "57", "X-RateLimit-Reset" "1484488885", "Connection" "close", "Status" "401 Unauthorized", "X-GitHub-Request-Id" "58A5EAEB:5D2A:2259F2B:587B7350", "X-GitHub-Media-Type" "github.v3; format=json", "Date" "Sun, 15 Jan 2017 13:04:17 GMT", "X-XSS-Protection" "1; mode=block", "Content-Security-Policy" "default-src 'none'"}, :body "{\"message\":\"Bad credentials\",\"documentation_url\":\"https://developer.github.com/v3\"}", :request-time 1197, :trace-redirects ["https://api.github.com/repos/fbiville/liquigraph/events?access_token=&page=1"], :orig-content-encoding nil}, compiling:(/private/var/folders/vn/t_jql4vn7fzb9cr0qxcxdqlm0000gn/T/form-init4838174981002994782.clj:1:125)
    at clojure.lang.Compiler.load(Compiler.java:7391)
    at clojure.lang.Compiler.loadFile(Compiler.java:7317)
    at clojure.main$load_script.invokeStatic(main.clj:275)
    at clojure.main$init_opt.invokeStatic(main.clj:277)
    at clojure.main$init_opt.invoke(main.clj:277)
    at clojure.main$initialize.invokeStatic(main.clj:308)
    at clojure.main$null_opt.invokeStatic(main.clj:342)
    at clojure.main$null_opt.invoke(main.clj:339)
    at clojure.main$main.invokeStatic(main.clj:421)
    at clojure.main$main.doInvoke(main.clj:384)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: clj-http: status 401 {:status 401, :headers {"Access-Control-Expose-Headers" "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Server" "GitHub.com", "Content-Type" "application/json; charset=utf-8", "Access-Control-Allow-Origin" "*", "X-Content-Type-Options" "nosniff", "Content-Length" "83", "X-Frame-Options" "deny", "Strict-Transport-Security" "max-age=31536000; includeSubdomains; preload", "X-RateLimit-Limit" "60", "X-RateLimit-Remaining" "57", "X-RateLimit-Reset" "1484488885", "Connection" "close", "Status" "401 Unauthorized", "X-GitHub-Request-Id" "58A5EAEB:5D2A:2259F2B:587B7350", "X-GitHub-Media-Type" "github.v3; format=json", "Date" "Sun, 15 Jan 2017 13:04:17 GMT", "X-XSS-Protection" "1; mode=block", "Content-Security-Policy" "default-src 'none'"}, :body "{\"message\":\"Bad credentials\",\"documentation_url\":\"https://developer.github.com/v3\"}", :request-time 1197, :trace-redirects ["https://api.github.com/repos/fbiville/liquigraph/events?access_token=&page=1"], :orig-content-encoding nil}
    at slingshot.support$stack_trace.invoke(support.clj:201)
    at clj_http.client$wrap_exceptions$fn__2128.invoke(client.clj:226)
    at clj_http.client$wrap_accept$fn__2288.invoke(client.clj:595)
    at clj_http.client$wrap_accept_encoding$fn__2294.invoke(client.clj:609)
    at clj_http.client$wrap_content_type$fn__2283.invoke(client.clj:585)
    at clj_http.client$wrap_form_params$fn__2367.invoke(client.clj:765)
    at clj_http.client$wrap_nested_params$fn__2384.invoke(client.clj:790)
    at clj_http.client$wrap_method$fn__2337.invoke(client.clj:707)
    at clj_http.cookies$wrap_cookies$fn__1048.invoke(cookies.clj:124)
    at clj_http.links$wrap_links$fn__1969.invoke(links.clj:51)
    at clj_http.client$wrap_unknown_host$fn__2393.invoke(client.clj:810)
    at clj_http.client$get.invokeStatic(client.clj:913)
    at clj_http.client$get.doInvoke(client.clj:909)
    at clojure.lang.RestFn.invoke(RestFn.java:423)
    at hubstats.github$github_api_events.invokeStatic(github.clj:14)
    at hubstats.github$github_api_events.invoke(github.clj:11)
    at hubstats.github$events.invokeStatic(github.clj:20)
    at hubstats.github$events.invoke(github.clj:16)
    at hubstats.github$events.invokeStatic(github.clj:23)
    at hubstats.github$events.invoke(github.clj:16)
    at hubstats.github$events.invokeStatic(github.clj:28)
    at hubstats.github$events.invoke(github.clj:16)
    at hubstats.github$pr_stats.invokeStatic(github.clj:72)
    at hubstats.github$pr_stats.invoke(github.clj:62)
    at hubstats.core$_main.invokeStatic(core.clj:36)
    at hubstats.core$_main.doInvoke(core.clj:26)
    at clojure.lang.RestFn.invoke(RestFn.java:457)
    at clojure.lang.Var.invoke(Var.java:394)
    at user$eval5.invokeStatic(form-init4838174981002994782.clj:1)
    at user$eval5.invoke(form-init4838174981002994782.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6927)
    at clojure.lang.Compiler.eval(Compiler.java:6917)
    at clojure.lang.Compiler.load(Compiler.java:7379)
    ... 14 more
nicokosi commented 7 years ago

@fbiville There I fixed it: https://github.com/nicokosi/hubstats/pull/9 (in a lazy way ๐Ÿ˜‡)