# OAuthClientOptions

`interface` in `plugin-oauth` · v0.1.0

<https://seedcord.org/docs/packages/plugin-oauth/0.1.0/interfaces/oauth-client-options>

What [`OAuthClient`](/docs/packages/plugin-oauth/0.1.0/classes/oauth-client) needs to talk to Discord and to keep each user's tokens.

```ts
interface OAuthClientOptions<
    TScopes extends OAuthScope = never,
    TExtra extends OAuthScope = never
>
```

## Properties

### baseUrl

```ts
baseUrl: string | URL;
```

The public address of your server. It can have a path, like `https://example.com/bot`. The login
routes are under it.

### clientId

```ts
clientId: string;
```

The application's id.

### clientSecret

```ts
clientSecret: string;
```

The client secret from the application's OAuth2 page. The client also derives the token encryption
key from it. After you rotate it, every user has to log in again.

### extraScopes

```ts
extraScopes?: readonly TExtra[] | undefined
```

Scopes that only some of your features need. A login requests one only when its link lists it, and
the typed calls for it resolve to `undefined` for a user who hasn't granted it yet.

### keepOpen

```ts
keepOpen?: ((work: Promise<void>) => void) | undefined
```

Only for Cloudflare Workers, where you pass `waitUntil` from `cloudflare:workers`. The client hands
it every change to a user's tokens. Workers freezes a change once its request ends, and that user's
later calls would wait on it forever. The `OAuth` plugin sets this for you.

### rest

```ts
rest: REST;
```

A `@discordjs/rest` client. Every call waits in its rate limit queue. Only `joinGuild()` sends its
bot token.

### routes

```ts
routes?: OAuthRoutes | undefined
```

Set these when your site already has its own paths for a Discord login.

### scopes

```ts
scopes?: readonly TScopes[] | undefined
```

The scopes to request on every login. The client always adds `identify`.

### store

```ts
store: TokenStore;
```

Where the tokens are kept, encrypted.
