Commit graph

13 commits

Author SHA1 Message Date
vertextau
95cbc56dec Improve randomString func 2020-02-13 22:42:58 +01:00
Mislav Marohnić
fe7cdd8ab7 Extract web browser launching to a package
This fixes opening URLs with `&` on Windows.
2020-01-29 11:49:38 +01:00
Mislav Marohnić
853fda13e9 Add more OAuth flow debugging to stderr with DEBUG=oauth 2020-01-13 20:31:31 +01:00
Mislav Marohnić
d6a437a93c Add a TODO to make scopes configurable 2020-01-13 20:17:20 +01:00
Mislav Marohnić
bbeb558fce Narrow the scope of the local server handler
Before, the local server handled any request regardless of path, which
could potentially include requests generated by the browser such as the
one for favicon. This could lead to race conditions around reading the
code to continue to OAuth flow with.

Now, have the OAuth flow redirect to `localhost:PORT/callback` and only
handle `/callback` requests specifically.
2020-01-13 20:14:00 +01:00
Mislav Marohnić
635d2963f6 Add more explicit error handling around the OAuth flow 2020-01-13 20:13:41 +01:00
Mislav Marohnić
295c5d122b Fix opening OAuth URL in browser 2019-11-27 14:08:42 +01:00
Mislav Marohnić
5aca575964 Wire up OAuth authentication flow to initialize config file
The config file is now `~/.config/gh`.
2019-10-18 19:08:11 +02:00
Mislav Marohnić
de85294c79 Extract OAuth logic into a struct 2019-10-18 15:44:46 +02:00
Mislav Marohnić
7bf306f022 Generate and verify random "state" value
This is for extra security during OAuth flow.
2019-10-18 15:44:46 +02:00
Mislav Marohnić
216ffb89e2 Use random available port number 2019-10-18 15:44:46 +02:00
Mislav Marohnić
db0084f623 One weird trick to prevent macOS firewall popup
Discovered by a stay-at-home developer!
2019-10-18 15:44:46 +02:00
Mislav Marohnić
d90552454d Preliminary OAuth flow 2019-10-18 15:44:44 +02:00