---
type: api
title: Handle OAuth callback
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-get-actions-connector-oauth-callback
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-get-actions-connector-oauth-callback
products:
  - Kibana
---

# Handle OAuth callback

Availability: 9.4+

- Server: `https://{kibana_url}`

## Paths

- `GET` `/api/actions/connector/_oauth_callback`
- `GET` `/s/{space_id}/api/actions/connector/_oauth_callback`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#basicauth)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Handles the OAuth 2.0 authorization code callback from external providers. Exchanges the authorization code for access and refresh tokens.<br/><br/>[Required authorization] Route required privileges: actions:oauth.

## Query String Parameters

- `code` (string)
  The authorization code returned by the OAuth provider.
- `state` (string)
  The state parameter for CSRF protection.
- `error` (string)
  Error code if the authorization failed.
- `error_description` (string)
  Human-readable error description.
- `session_state` (string)
  Session state from the OAuth provider (e.g., Microsoft).

## Responses

#### `200`

Returns an HTML callback page.

#### `302`

Redirects to the return URL with authorization result query parameters.

#### `401`

User is not authenticated.

## Code Examples

#### Console

```console
GET /api/actions/connector/_oauth_callback
```

#### curl

```curl
curl -X GET "https://{kibana_url}/api/actions/connector/_oauth_callback"
```

