Files
coder/docs/api/git.md
Kyle Carberry 34467a3289 feat: add github device flow for authentication (#8232)
* feat: add github device flow for authentication

This will allow us to add a GitHub OAuth provider out-of-the-box
to reduce setup requirements.

* Improve askpass view

* Add routes to improve clarity of git auth

* Redesign the git auth page

* Refactor to add a page view

* Fix sideways layout

* Remove legacy notify

* Fix git auth redirects

* Add E2E tests

* Fix route documentation

* Fix imports

* Remove unused imports

* Fix E2E web test

* Fix friendly message appearance

* Fix layout shifting for full-screen sign-in

* Fix height going to 100%

* Fix comments
2023-06-29 18:58:01 +00:00

3.5 KiB

Git

Get git auth by ID

Code samples

# Example request using curl
curl -X GET http://coder-server:8080/api/v2/gitauth/{gitauth} \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

GET /gitauth/{gitauth}

Parameters

Name In Type Required Description
gitauth path string(string) true Git Provider ID

Example responses

200 Response

{
  "app_install_url": "string",
  "app_installable": true,
  "authenticated": true,
  "device": true,
  "installations": [
    {
      "account": {
        "avatar_url": "string",
        "login": "string",
        "name": "string",
        "profile_url": "string"
      },
      "configure_url": "string",
      "id": 0
    }
  ],
  "type": "string",
  "user": {
    "avatar_url": "string",
    "login": "string",
    "name": "string",
    "profile_url": "string"
  }
}

Responses

Status Meaning Description Schema
200 OK OK codersdk.GitAuth

To perform this operation, you must be authenticated. Learn more.

Get git auth device by ID.

Code samples

# Example request using curl
curl -X GET http://coder-server:8080/api/v2/gitauth/{gitauth}/device \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

GET /gitauth/{gitauth}/device

Parameters

Name In Type Required Description
gitauth path string(string) true Git Provider ID

Example responses

200 Response

{
  "device_code": "string",
  "expires_in": 0,
  "interval": 0,
  "user_code": "string",
  "verification_uri": "string"
}

Responses

Status Meaning Description Schema
200 OK OK codersdk.GitAuthDevice

To perform this operation, you must be authenticated. Learn more.

Post git auth device by ID

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/gitauth/{gitauth}/device \
  -H 'Coder-Session-Token: API_KEY'

POST /gitauth/{gitauth}/device

Parameters

Name In Type Required Description
gitauth path string(string) true Git Provider ID

Responses

Status Meaning Description Schema
204 No Content No Content

To perform this operation, you must be authenticated. Learn more.