Class: Ask::Auth::Providers::GithubCopilot

Inherits:
DeviceOAuth show all
Defined in:
lib/ask/auth/providers/github_copilot.rb

Overview

GitHub Copilot device OAuth — "bring your Copilot subscription". RFC 8628 device grant against github.com/login/device/code (the public Copilot CLI client id). Constants mirror opencode's github-copilot/copilot.ts.

Note: Copilot's device flow is a gray area of GitHub's terms — it works, but treat it as a user-beware integration.

Constant Summary collapse

CLIENT_ID =
"Ov23li8tweQw6odWQebz"
DEVICE_CODE_URL =
"https://github.com/login/device/code"
ACCESS_TOKEN_URL =
"https://github.com/login/oauth/access_token"
SCOPE =
"read:user"

Constants inherited from DeviceOAuth

DeviceOAuth::DEVICE_CODE_GRANT_TYPE

Instance Attribute Summary

Attributes inherited from OAuth

#client_id, #redirect_uri

Instance Method Summary collapse

Methods inherited from DeviceOAuth

#complete_device_flow, #start_device_flow

Methods inherited from OAuth

#authorize!, #authorize_url, #call, #generate_code_challenge, #generate_code_verifier, #refresh

Constructor Details

#initialize(storage: nil, client_id: CLIENT_ID, http: Ask::Auth::OAuth::HTTP) ⇒ GithubCopilot

Returns a new instance of GithubCopilot.



21
22
23
24
# File 'lib/ask/auth/providers/github_copilot.rb', line 21

def initialize(storage: nil, client_id: CLIENT_ID, http: Ask::Auth::OAuth::HTTP)
  super(storage: storage, client_id: client_id, token_url: ACCESS_TOKEN_URL,
    device_code_url: DEVICE_CODE_URL, scope: SCOPE, http: http)
end