# Git

## Get user external auths [#get-user-external-auths]

### Code samples [#code-samples]

```sh
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/external-auth \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'
```

`GET /api/v2/external-auth`

### Example responses [#example-responses]

> 200 Response

```json
{
  "authenticated": true,
  "created_at": "2019-08-24T14:15:22Z",
  "expires": "2019-08-24T14:15:22Z",
  "has_refresh_token": true,
  "provider_id": "string",
  "updated_at": "2019-08-24T14:15:22Z",
  "validate_error": "string"
}
```

### Responses [#responses]

| Status | Meaning                                                 | Description | Schema                                                                                  |
| ------ | ------------------------------------------------------- | ----------- | --------------------------------------------------------------------------------------- |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK          | [codersdk.ExternalAuthLink](/beta-docs/reference/api/schemas/#codersdkexternalauthlink) |

To perform this operation, you must be authenticated. [Learn more](/beta-docs/reference/api/authentication/).

## Get external auth by ID [#get-external-auth-by-id]

### Code samples [#code-samples-1]

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

`GET /api/v2/external-auth/{externalauth}`

### Parameters [#parameters]

| Name           | In   | Type           | Required | Description     |
| -------------- | ---- | -------------- | -------- | --------------- |
| `externalauth` | path | string(string) | true     | Git Provider ID |

### Example responses [#example-responses-1]

> 200 Response

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

### Responses [#responses-1]

| Status | Meaning                                                 | Description | Schema                                                                          |
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------- |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK          | [codersdk.ExternalAuth](/beta-docs/reference/api/schemas/#codersdkexternalauth) |

To perform this operation, you must be authenticated. [Learn more](/beta-docs/reference/api/authentication/).

## Delete external auth user link by ID [#delete-external-auth-user-link-by-id]

### Code samples [#code-samples-2]

```sh
# Example request using curl
curl -X DELETE http://coder-server:8080/api/v2/external-auth/{externalauth} \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'
```

`DELETE /api/v2/external-auth/{externalauth}`

### Parameters [#parameters-1]

| Name           | In   | Type           | Required | Description     |
| -------------- | ---- | -------------- | -------- | --------------- |
| `externalauth` | path | string(string) | true     | Git Provider ID |

### Example responses [#example-responses-2]

> 200 Response

```json
{
  "token_revocation_error": "string",
  "token_revoked": true
}
```

### Responses [#responses-2]

| Status | Meaning                                                 | Description | Schema                                                                                                              |
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------- |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK          | [codersdk.DeleteExternalAuthByIDResponse](/beta-docs/reference/api/schemas/#codersdkdeleteexternalauthbyidresponse) |

To perform this operation, you must be authenticated. [Learn more](/beta-docs/reference/api/authentication/).

## Get external auth device by ID [#get-external-auth-device-by-id]

### Code samples [#code-samples-3]

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

`GET /api/v2/external-auth/{externalauth}/device`

### Parameters [#parameters-2]

| Name           | In   | Type           | Required | Description     |
| -------------- | ---- | -------------- | -------- | --------------- |
| `externalauth` | path | string(string) | true     | Git Provider ID |

### Example responses [#example-responses-3]

> 200 Response

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

### Responses [#responses-3]

| Status | Meaning                                                 | Description | Schema                                                                                      |
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------- |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK          | [codersdk.ExternalAuthDevice](/beta-docs/reference/api/schemas/#codersdkexternalauthdevice) |

To perform this operation, you must be authenticated. [Learn more](/beta-docs/reference/api/authentication/).

## Post external auth device by ID [#post-external-auth-device-by-id]

### Code samples [#code-samples-4]

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

`POST /api/v2/external-auth/{externalauth}/device`

### Parameters [#parameters-3]

| Name           | In   | Type           | Required | Description          |
| -------------- | ---- | -------------- | -------- | -------------------- |
| `externalauth` | path | string(string) | true     | External Provider ID |

### Responses [#responses-4]

| Status | Meaning                                                         | Description | Schema |
| ------ | --------------------------------------------------------------- | ----------- | ------ |
| 204    | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content  |        |

To perform this operation, you must be authenticated. [Learn more](/beta-docs/reference/api/authentication/).
