#oauth #refresh-token #github

bin+lib github-device-flow

Binary and library for performing the GitHub Device Flow

6 releases

0.2.0 Jan 26, 2024
0.1.4 Jun 16, 2023
0.1.3 Sep 2, 2022
0.1.2 Aug 19, 2022

#8 in #refresh-token

Download history 1151/week @ 2024-06-30 447/week @ 2024-07-07 676/week @ 2024-07-14 429/week @ 2024-07-21 757/week @ 2024-07-28 570/week @ 2024-08-04 668/week @ 2024-08-11 506/week @ 2024-08-18 715/week @ 2024-08-25 218/week @ 2024-09-01 330/week @ 2024-09-08 289/week @ 2024-09-15 275/week @ 2024-09-22 259/week @ 2024-09-29 278/week @ 2024-10-06 256/week @ 2024-10-13

1,090 downloads per month

MIT license

17KB
306 lines

gh-device-flow

Crate that implements the GitHub Device Flow for authenticating with GitHub Apps.

It also implements the refresh mechanism for GitHub Apps that use GitHub's token expiration feature.

Usage

To use the CLI, download the binary for your architecture/OS from the latest release.

Once extracted, execute the command providing the Client ID for your App:

github-device-flow --client-id Iv1.8675309ABCDEFGH

This will prompt you to open a browser window and provide the generated device code. Once completed, your access token will be printed to STDOUT as a JSON object. If your App requests refresh tokens one will also be printed.

To refresh your OAuth Access using a Refresh Token, pass it as a --refresh flag:

github-device-flow --client-id Iv1.8675309ABCDEFGH --refresh thisisnotarefreshtoken

To view the full help, pass the --help flag:

$ github-device-flow --help
github-device-flow 0.1.2
Binary and library for performing the GitHub Device Flow

USAGE:
    github-device-flow [OPTIONS] --client-id <CLIENT_ID>

OPTIONS:
    -c, --client-id <CLIENT_ID>    Client ID
    -h, --host <HOST>              The host to authenticate with
        --help                     Print help information
    -r, --refresh <REFRESH>        A Refresh Token to exchange
    -V, --version                  Print version information

Dependencies

~6–18MB
~266K SLoC