---
title: supertokens-web-js/recipe/oauth2provider
description: References documentation for the supertokens-web-js/recipe/oauth2provider package
sidebar:
  order: 110
---

## Classes

### default

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/oauth2provider/index.ts:28](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/oauth2provider/index.ts#L28)

#### Constructors

##### Constructor

```ts check=false reason="Generated API signature"
new default(): default;
```

###### Returns

[`default`](#default)

#### Methods

##### getLoginChallengeInfo()

```ts check=false reason="Generated API signature"
static getLoginChallengeInfo(input): Promise<{
  fetchResponse: Response;
  info: LoginInfo;
  status: "OK";
}>;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/oauth2provider/index.ts:46](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/oauth2provider/index.ts#L46)

Returns information about an OAuth login in progress

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `loginChallenge`: `string`; `options?`: [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions); `userContext?`: `any`; \} |
| `input.loginChallenge` | `string` |
| `input.options?` | [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions) |
| `input.userContext?` | `any` |

###### Returns

`Promise`\<\{
  `fetchResponse`: `Response`;
  `info`: [`LoginInfo`](recipe-oauth2provider-types#logininfo);
  `status`: `"OK"`;
\}\>

`{status: "OK", info: LoginInfo}`

###### Throws

STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"`

##### getRedirectURLToContinueOAuthFlow()

```ts check=false reason="Generated API signature"
static getRedirectURLToContinueOAuthFlow(input): Promise<{
  fetchResponse: Response;
  frontendRedirectTo: string;
  status: "OK";
}>;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/oauth2provider/index.ts:74](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/oauth2provider/index.ts#L74)

Accepts the OAuth2 Login request and returns the redirect URL to continue the OAuth flow.

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `loginChallenge`: `string`; `options?`: [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions); `userContext?`: `any`; \} |
| `input.loginChallenge` | `string` |
| `input.options?` | [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions) |
| `input.userContext?` | `any` |

###### Returns

`Promise`\<\{
  `fetchResponse`: `Response`;
  `frontendRedirectTo`: `string`;
  `status`: `"OK"`;
\}\>

`{status: "OK", frontendRedirectTo: string}`

###### Throws

STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"`

##### init()

```ts check=false reason="Generated API signature"
static init(config?): CreateRecipeFunction<PreAndPostAPIHookAction>;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/oauth2provider/index.ts:29](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/oauth2provider/index.ts#L29)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `config?` | [`UserInput`](recipe-oauth2provider-types#userinput) |

###### Returns

[`CreateRecipeFunction`](types#createrecipefunction)\<[`PreAndPostAPIHookAction`](recipe-oauth2provider-types#preandpostapihookaction)\>

##### logOut()

```ts check=false reason="Generated API signature"
static logOut(input): Promise<{
  fetchResponse: Response;
  frontendRedirectTo: string;
  status: "OK";
}>;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/oauth2provider/index.ts:102](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/oauth2provider/index.ts#L102)

Accepts the OAuth2 Logout request, clears the SuperTokens session and returns post logout redirect URL.

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `logoutChallenge`: `string`; `options?`: [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions); `userContext?`: `any`; \} |
| `input.logoutChallenge` | `string` |
| `input.options?` | [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions) |
| `input.userContext?` | `any` |

###### Returns

`Promise`\<\{
  `fetchResponse`: `Response`;
  `frontendRedirectTo`: `string`;
  `status`: `"OK"`;
\}\>

`{status: "OK", frontendRedirectTo: string}`

###### Throws

STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"`

## Variables

### getLoginChallengeInfo()

```ts check=false reason="Generated API signature"
const getLoginChallengeInfo: (input) => Promise<{
  fetchResponse: Response;
  info: LoginInfo;
  status: "OK";
}> = RecipeWrapper.getLoginChallengeInfo;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/oauth2provider/index.ts:115](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/oauth2provider/index.ts#L115)

Returns information about an OAuth login in progress

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `loginChallenge`: `string`; `options?`: [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions); `userContext?`: `any`; \} |
| `input.loginChallenge` | `string` |
| `input.options?` | [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions) |
| `input.userContext?` | `any` |

#### Returns

`Promise`\<\{
  `fetchResponse`: `Response`;
  `info`: [`LoginInfo`](recipe-oauth2provider-types#logininfo);
  `status`: `"OK"`;
\}\>

`{status: "OK", info: LoginInfo}`

#### Throws

STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"`

***

### getRedirectURLToContinueOAuthFlow()

```ts check=false reason="Generated API signature"
const getRedirectURLToContinueOAuthFlow: (input) => Promise<{
  fetchResponse: Response;
  frontendRedirectTo: string;
  status: "OK";
}> = RecipeWrapper.getRedirectURLToContinueOAuthFlow;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/oauth2provider/index.ts:116](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/oauth2provider/index.ts#L116)

Accepts the OAuth2 Login request and returns the redirect URL to continue the OAuth flow.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `loginChallenge`: `string`; `options?`: [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions); `userContext?`: `any`; \} |
| `input.loginChallenge` | `string` |
| `input.options?` | [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions) |
| `input.userContext?` | `any` |

#### Returns

`Promise`\<\{
  `fetchResponse`: `Response`;
  `frontendRedirectTo`: `string`;
  `status`: `"OK"`;
\}\>

`{status: "OK", frontendRedirectTo: string}`

#### Throws

STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"`

***

### init()

```ts check=false reason="Generated API signature"
const init: (config?) => CreateRecipeFunction<PreAndPostAPIHookAction> = RecipeWrapper.init;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/oauth2provider/index.ts:114](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/oauth2provider/index.ts#L114)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `config?` | [`UserInput`](recipe-oauth2provider-types#userinput) |

#### Returns

[`CreateRecipeFunction`](types#createrecipefunction)\<[`PreAndPostAPIHookAction`](recipe-oauth2provider-types#preandpostapihookaction)\>

***

### logOut()

```ts check=false reason="Generated API signature"
const logOut: (input) => Promise<{
  fetchResponse: Response;
  frontendRedirectTo: string;
  status: "OK";
}> = RecipeWrapper.logOut;
```

Defined in: [tmp/supertokens-web-js/lib/ts/recipe/oauth2provider/index.ts:117](https://github.com/supertokens/supertokens-web-js/blob/be2e0fd7dcade8352cdc9639abe968e5cda5b1cd/lib/ts/recipe/oauth2provider/index.ts#L117)

Accepts the OAuth2 Logout request, clears the SuperTokens session and returns post logout redirect URL.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `logoutChallenge`: `string`; `options?`: [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions); `userContext?`: `any`; \} |
| `input.logoutChallenge` | `string` |
| `input.options?` | [`RecipeFunctionOptions`](recipe-emailpassword#recipefunctionoptions) |
| `input.userContext?` | `any` |

#### Returns

`Promise`\<\{
  `fetchResponse`: `Response`;
  `frontendRedirectTo`: `string`;
  `status`: `"OK"`;
\}\>

`{status: "OK", frontendRedirectTo: string}`

#### Throws

STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"`

## References

### LoginInfo

Re-exports [LoginInfo](recipe-oauth2provider-types#logininfo)

***

### PostAPIHookContext

Re-exports [PostAPIHookContext](recipe-oauth2provider-types#postapihookcontext)

***

### PreAndPostAPIHookAction

Re-exports [PreAndPostAPIHookAction](recipe-oauth2provider-types#preandpostapihookaction)

***

### PreAPIHookContext

Re-exports [PreAPIHookContext](recipe-oauth2provider-types#preapihookcontext)

***

### RecipeFunctionOptions

Re-exports [RecipeFunctionOptions](recipe-emailpassword#recipefunctionoptions)

***

### RecipeInterface

Re-exports [RecipeInterface](recipe-oauth2provider-types#recipeinterface)

***

### UserInput

Re-exports [UserInput](recipe-oauth2provider-types#userinput)
