> ## Documentation Index
> Fetch the complete documentation index at: https://ona.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Check Authentication For Host

> Checks if a user is authenticated for a specific host.

`Unary` · [`Runners`](/docs/api-reference/generated/runner/overview)

Checks if a user is authenticated for a specific host.

Use this method to:

* Verify authentication status
* Get authentication URLs
* Check PAT support

### Examples

* Check authentication:

  Verifies authentication for a host.

  ```yaml theme={null}
  host: "github.com"
  ```

## Endpoint

```text theme={null}
POST /api/gitpod.v1.RunnerService/CheckAuthenticationForHost
```

Send a Bearer token as described in [Authentication](/docs/api-reference#authenticate-requests). If your organization uses a custom management-plane domain, replace `https://app.ona.com` with that domain.

## Request example

<CodeGroup>
  ```bash cURL theme={null}
  export ONA_HOST=https://app.ona.com
  export ONA_API_KEY=<your-token>

  curl --request POST \
    --url "$ONA_HOST/api/gitpod.v1.RunnerService/CheckAuthenticationForHost" \
    --header "Authorization: Bearer $ONA_API_KEY" \
    --header "Content-Type: application/json" \
    --data '{
    "runnerId": "<runner-id>"
  }'
  ```

  ```python Python theme={null}
  import gitpod.v1.runner_pb2 as runner_pb2
  from ona_sdk import create_client_from_env

  ona = create_client_from_env()
  request = runner_pb2.CheckAuthenticationForHostRequest(
      runner_id="<runner-id>",
  )
  response = ona.services.runner.check_authentication_for_host(request)
  print(response)
  ```

  ```typescript TypeScript theme={null}
  import { create } from "@bufbuild/protobuf";
  import { createClientFromEnv } from "@gitpod/sdk";
  import { CheckAuthenticationForHostRequestSchema } from "@gitpod/sdk/gitpod/v1/runner_pb";

  async function main() {
    const ona = createClientFromEnv();
    const request = create(CheckAuthenticationForHostRequestSchema, {
      runnerId: "<runner-id>",
    });
    const response = await ona.services.runner.checkAuthenticationForHost(request);
    console.log(response);
  }

  main().catch(console.error);
  ```

  ```go Go theme={null}
  package main

  import (
  	"context"
  	"fmt"
  	"log"

  	"connectrpc.com/connect"
  	"github.com/gitpod-io/gitpod-sdk-go/sdk"
  	gitpodpb "github.com/gitpod-io/gitpod-sdk-go/v1"
  )

  func main() {
  	ona, err := sdk.NewFromEnv()
  	if err != nil {
  		log.Fatal(err)
  	}

  	request := connect.NewRequest(&gitpodpb.CheckAuthenticationForHostRequest{
  		RunnerId: "<runner-id>",
  	})
  	response, err := ona.Services.Runner.CheckAuthenticationForHost(context.Background(), request)
  	if err != nil {
  		log.Fatal(err)
  	}
  	fmt.Println(response.Msg)
  }
  ```

  ```json Request body theme={null}
  {
    "runnerId": "<runner-id>"
  }
  ```
</CodeGroup>

## Request

`gitpod.v1.CheckAuthenticationForHostRequest`

| Field      | Type   | Required | Description                      |
| ---------- | ------ | -------- | -------------------------------- |
| `runnerId` | string | No       | Constraints: `string.uuid=true`. |
| `host`     | string | No       |                                  |

## Response

`gitpod.v1.CheckAuthenticationForHostResponse`

| Field               | Type                                                                                                                                          | Required | Description                                                                         |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------- |
| `authenticated`     | boolean                                                                                                                                       | No       |                                                                                     |
| `authenticationUrl` | string                                                                                                                                        | No       | **Deprecated.**                                                                     |
| `patSupported`      | boolean                                                                                                                                       | No       | **Deprecated.**                                                                     |
| `scmId`             | string                                                                                                                                        | No       | scm\_id is the unique identifier of the SCM provider                                |
| `scmName`           | string                                                                                                                                        | No       | scm\_name is the human-readable name of the SCM provider (e.g., "GitHub", "GitLab") |
| `supportsOauth2`    | [AuthenticationMethodOAuth2](#type-gitpod-v1-check-authentication-for-host-response-authentication-method-o-auth2)                            | No       | supports\_oauth2 indicates that the host supports OAuth2 authentication             |
| `supportsPat`       | [AuthenticationMethodPersonalAccessToken](#type-gitpod-v1-check-authentication-for-host-response-authentication-method-personal-access-token) | No       | supports\_pat indicates that the host supports Personal Access Token authentication |

## Related types

<a id="type-gitpod-v1-check-authentication-for-host-response-authentication-method-o-auth2" />

<Accordion title="AuthenticationMethodOAuth2">
  `gitpod.v1.CheckAuthenticationForHostResponse.AuthenticationMethodOAuth2`

  | Field     | Type   | Required | Description                                                                     |
  | --------- | ------ | -------- | ------------------------------------------------------------------------------- |
  | `authUrl` | string | No       | auth\_url is the URL where users can authenticate                               |
  | `docsUrl` | string | No       | docs\_url is the URL to the documentation explaining this authentication method |
</Accordion>

<a id="type-gitpod-v1-check-authentication-for-host-response-authentication-method-personal-access-token" />

<Accordion title="AuthenticationMethodPersonalAccessToken">
  `gitpod.v1.CheckAuthenticationForHostResponse.AuthenticationMethodPersonalAccessToken`

  | Field            | Type            | Required | Description                                                                        |
  | ---------------- | --------------- | -------- | ---------------------------------------------------------------------------------- |
  | `createUrl`      | string          | No       | create\_url is the URL where users can create a new Personal Access Token          |
  | `docsUrl`        | string          | No       | docs\_url is the URL to the documentation explaining PAT usage for this host       |
  | `example`        | string          | No       | example is an example of a Personal Access Token                                   |
  | `requiredScopes` | array of string | No       | required\_scopes is the list of permissions required for the Personal Access Token |
</Accordion>
