# Receive OAuth Callback

`GET /gate/idp/{provider}/callback` · Identity & Access · Federation

Receives the authorization code and state from the identity provider after an end user authenticates. The state must be one this project issued for this provider.

The gateway exchanges the code with the provider, resolves or provisions the end user, and redirects to the app's `redirectUri` with a single-use `code` in the fragment, valid for 60 seconds.

No session exists yet: the page gets one from `POST /@{projectSlug}/gate/idp/exchange`. Failures redirect with `error` and `error_description` in the fragment.

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `provider` | path | yes |  Example: `"google"`. |
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Responses


## Errors

| HTTP | Code | When |
|---|---|---|
| 400 | `K9O_INVALID_FIELD_VALUE` | The project path segment does not resolve to a live project, so it is rejected as an invalid project identifier. |
| 502 | `K9O_IDP_FEDERATION_FAILED` | The identity provider returned a response that could not be validated or exchanged for a platform session. |

## Code samples

### cURL

```bash
curl -X GET 'https://<org>.api-<region>.k9o.io/@storefront/gate/idp/google/callback'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/gate/idp/google/callback', {
  method: 'GET',
});
const { data, meta } = await res.json();
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/identity-access/receive-oauth-callback
