# OAuth Callback Get

`GET https://api.torbox.app/v1/api/integration/oauth/{provider}/callback`

- Operation ID: `oauth_callback_get`
- Group: Integrations
- Auth: none

### Overview

The address a service sends the user's browser back to after the login started by Authenticate OAuth. It is reached by the browser on its way back from the service, not called by you. The service adds its `code` and `state` to the query string.

TorBox exchanges the code for the service's tokens, looks up who the user is at that service, and redirects the browser to the TorBox website with the result in the query string:

`https://torbox.app/oauth/{provider}/success?token=...&expires_in=...&expires_at=...&user_id=...&id_token=...&nonce=...&refresh_token=...`

- `token` -> the access token the service issued
- `refresh_token` -> the refresh token the service issued
- `expires_in`, `expires_at` -> as found in the service's token answer
- `user_id` -> who the user is at the service. The email address for `google` and `apple`, the `email` field of the Discord user for `discord`, the user id for `patreon`, `anilist` and `mal`, the user name for `trakt` and `simkl`. Not set for `dropbox` and `onedrive`.
- `id_token` -> the ID token for `google` and `apple`, the Discord user id for `discord`. Not set for the other providers.
- `nonce` -> the name of the provider

A value the service did not give is sent as the text `None`.

This route stores nothing on a TorBox account. The tokens it hands over are the ones Register OAuth Link, Link Discord Roles and the upload routes take.

If the login was cancelled, has expired or fails, the route answers with a JSON error instead of a redirect.

### Authorization

None required.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `provider` | path | string | yes | The service the login was started with. One of `google`, `dropbox`, `discord`, `onedrive`, `patreon`, `apple`, `anilist`, `mal`, `trakt` or `simkl`. |

## Responses

- `302` Found
- `400` Bad Request
- `404` Not Found
- `422` Validation Error
- `429` Too Many Requests
- `500` Internal Server Error
