https://github.com/wojtekmach/req_github_oauth
https://github.com/wojtekmach/req_github_oauth
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/wojtekmach/req_github_oauth
- Owner: wojtekmach
- Created: 2021-11-10T10:48:31.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-01T08:40:46.000Z (about 2 years ago)
- Last Synced: 2025-04-02T12:43:30.324Z (6 months ago)
- Language: Elixir
- Size: 15.6 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# ReqGitHubOAuth
[Req](https://github.com/wojtekmach/req) plugin for GitHub authentication.
The plugin authenticates requests to GitHub using [GitHub OAuth Device Flow](https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#device-flow).
The GitHub OAuth it uses is: .## Usage
```elixir
Mix.install([
{:req, "~> 0.3.0"},
{:req_github_oauth, "~> 0.1.0"}
])req = Req.new(http_errors: :raise) |> ReqGitHubOAuth.attach()
Req.get!(req, url: "https://api.github.com/user").body["login"]
# Outputs:
# paste this user code:
#
# 6C44-30A8
#
# at:
#
# https://github.com/login/device
#
# open browser window? [Yn]
# 15:22:28.350 [info] response: authorization_pending
# 15:22:33.519 [info] response: authorization_pending
# 15:22:38.678 [info] response: success
#=> "wojtekmach"Req.get!(req, url: "https://api.github.com/user").body["login"]
#=> "wojtekmach"
```