---
title: "OAuth2 callback"
method: GET
path: "/oauth2/callback/{provider}"
tags: ["OAuth2 Plugin"]
---

# OAuth2 callback

`GET /oauth2/callback/{provider}`

Handles the OAuth2 callback from the provider. Exchanges the authorization code for tokens, creates or links a user account, and returns the authenticated user and session.

## Path parameters

- `provider` string, required

## Query parameters

- `code` string, required
- `state` string, required
- `error` string

## Response `200`

OK

- CallbackResponse
  - `session` Session, required
    - `created_at` string, date-time, required
    - `expires_at` string, date-time, required
    - `id` string, required
    - `ip_address` string, nullable
    - `token` string, required
    - `updated_at` string, date-time, required
    - `user_agent` string, nullable
    - `user_id` string, required
  - `user` User, required
    - `created_at` string, date-time, required
    - `email` string, required
    - `email_verified` boolean, required
    - `id` string, required
    - `image` string, nullable
    - `metadata` object, nullable
    - `name` string, required
    - `updated_at` string, date-time, required

---

[API](https://skmtc.net/authula/apis/authula-api.md) · [All operations](https://skmtc.net/authula/apis/authula-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/authula/authula-api/revisions/ee28a7965ce5/schema)
