Skip to content
Esc
navigateopen⌘Jpreview
Dashboard
On this page

supertokens-node/recipe/oauth2provider/types

References documentation for the supertokens-node/recipe/oauth2provider/types package

Type Aliases

APIInterface

type APIInterface = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
authGET | undefined | (input) => Promise< | { cookies?: string[]; redirectTo: string; } | ErrorOAuth2 | GeneralErrorResponse> recipe/oauth2provider/types.ts
endSessionGET | undefined | (input) => Promise< | { redirectTo: string; } | ErrorOAuth2 | GeneralErrorResponse> recipe/oauth2provider/types.ts
endSessionPOST | undefined | (input) => Promise< | { redirectTo: string; } | ErrorOAuth2 | GeneralErrorResponse> recipe/oauth2provider/types.ts
introspectTokenPOST | undefined | (input) => Promise< | InstrospectTokenResponse | GeneralErrorResponse | ErrorOAuth2> recipe/oauth2provider/types.ts
loginGET | undefined | (input) => Promise< | { cookies?: string[]; frontendRedirectTo: string; } | ErrorOAuth2 | GeneralErrorResponse> recipe/oauth2provider/types.ts
loginInfoGET | undefined | (input) => Promise< | { info: LoginInfo; status: "OK"; } | ErrorOAuth2 | GeneralErrorResponse> recipe/oauth2provider/types.ts
logoutPOST | undefined | (input) => Promise< | { frontendRedirectTo: string; status: "OK"; } | ErrorOAuth2 | GeneralErrorResponse> recipe/oauth2provider/types.ts
revokeTokenPOST | undefined | (input) => Promise< | { status: "OK"; } | ErrorOAuth2> recipe/oauth2provider/types.ts
tokenPOST | undefined | (input) => Promise< | TokenInfo | ErrorOAuth2 | GeneralErrorResponse> recipe/oauth2provider/types.ts
userInfoGET | undefined | (input) => Promise< | JSONObject | GeneralErrorResponse> recipe/oauth2provider/types.ts

APIOptions

type APIOptions = object;

Defined in: recipe/oauth2provider/types.ts

Properties


ConsentRequest

type ConsentRequest = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
acr? string recipe/oauth2provider/types.ts
amr? string[] recipe/oauth2provider/types.ts
challenge string recipe/oauth2provider/types.ts
client? OAuth2Client recipe/oauth2provider/types.ts
context? JSONObject recipe/oauth2provider/types.ts
loginChallenge? string recipe/oauth2provider/types.ts
loginSessionId? string recipe/oauth2provider/types.ts
oidcContext? any recipe/oauth2provider/types.ts
requestedAccessTokenAudience? string[] recipe/oauth2provider/types.ts
requestedScope? string[] recipe/oauth2provider/types.ts
skip? boolean recipe/oauth2provider/types.ts
subject? string recipe/oauth2provider/types.ts

CreateOAuth2ClientInput

type CreateOAuth2ClientInput = Partial<Omit<OAuth2ClientOptions, "createdAt" | "updatedAt">>;

Defined in: recipe/oauth2provider/types.ts


DeleteOAuth2ClientInput

type DeleteOAuth2ClientInput = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
clientId string recipe/oauth2provider/types.ts

ErrorOAuth2

type ErrorOAuth2 = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
error string recipe/oauth2provider/types.ts
errorDescription string recipe/oauth2provider/types.ts
status "ERROR" recipe/oauth2provider/types.ts
statusCode? number recipe/oauth2provider/types.ts

GetOAuth2ClientsInput

type GetOAuth2ClientsInput = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Description Defined in
clientName? string The name of the clients to filter by. recipe/oauth2provider/types.ts
pageSize? number Items per Page. Defaults to 250. recipe/oauth2provider/types.ts
paginationToken? string Next Page Token. Defaults to “1”. recipe/oauth2provider/types.ts

InstrospectTokenResponse

type InstrospectTokenResponse = 
  | {
  active: false;
}
  | object & JSONObject;

Defined in: recipe/oauth2provider/types.ts


LoginInfo

type LoginInfo = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
clientId string recipe/oauth2provider/types.ts
clientName string recipe/oauth2provider/types.ts
clientUri? string recipe/oauth2provider/types.ts
logoUri? string recipe/oauth2provider/types.ts
metadata? Record<string, any> | null recipe/oauth2provider/types.ts
policyUri? string recipe/oauth2provider/types.ts
tosUri? string recipe/oauth2provider/types.ts

LoginRequest

type LoginRequest = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
challenge string recipe/oauth2provider/types.ts
client OAuth2Client recipe/oauth2provider/types.ts
oidcContext? any recipe/oauth2provider/types.ts
requestedAccessTokenAudience? string[] recipe/oauth2provider/types.ts
requestedScope? string[] recipe/oauth2provider/types.ts
requestUrl string recipe/oauth2provider/types.ts
sessionId? string recipe/oauth2provider/types.ts
skip boolean recipe/oauth2provider/types.ts
subject string recipe/oauth2provider/types.ts

OAuth2ClientOptions

type OAuth2ClientOptions = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
audience? string[] recipe/oauth2provider/types.ts
authorizationCodeGrantAccessTokenLifespan? string | null recipe/oauth2provider/types.ts
authorizationCodeGrantIdTokenLifespan? string | null recipe/oauth2provider/types.ts
authorizationCodeGrantRefreshTokenLifespan? string | null recipe/oauth2provider/types.ts
clientCredentialsGrantAccessTokenLifespan? string | null recipe/oauth2provider/types.ts
clientId string recipe/oauth2provider/types.ts
clientName string recipe/oauth2provider/types.ts
clientSecret? string recipe/oauth2provider/types.ts
clientUri? string recipe/oauth2provider/types.ts
createdAt string recipe/oauth2provider/types.ts
enableRefreshTokenRotation? boolean recipe/oauth2provider/types.ts
grantTypes? string[] | null recipe/oauth2provider/types.ts
implicitGrantAccessTokenLifespan? string | null recipe/oauth2provider/types.ts
implicitGrantIdTokenLifespan? string | null recipe/oauth2provider/types.ts
logoUri? string recipe/oauth2provider/types.ts
metadata? Record<string, any> recipe/oauth2provider/types.ts
policyUri? string recipe/oauth2provider/types.ts
postLogoutRedirectUris? string[] recipe/oauth2provider/types.ts
redirectUris? string[] | null recipe/oauth2provider/types.ts
refreshTokenGrantAccessTokenLifespan? string | null recipe/oauth2provider/types.ts
refreshTokenGrantIdTokenLifespan? string | null recipe/oauth2provider/types.ts
refreshTokenGrantRefreshTokenLifespan? string | null recipe/oauth2provider/types.ts
responseTypes? string[] | null recipe/oauth2provider/types.ts
scope string recipe/oauth2provider/types.ts
tokenEndpointAuthMethod string recipe/oauth2provider/types.ts
tosUri? string recipe/oauth2provider/types.ts
updatedAt string recipe/oauth2provider/types.ts

PayloadBuilderFunction()

type PayloadBuilderFunction = (user, scopes, sessionHandle, userContext) => Promise<JSONObject>;

Defined in: recipe/oauth2provider/types.ts

Parameters

Parameter Type
user User
scopes string[]
sessionHandle string
userContext UserContext

Returns

Promise<JSONObject>


RecipeInterface

type RecipeInterface = object;

Defined in: recipe/oauth2provider/types.ts

Methods

acceptConsentRequest()
acceptConsentRequest(input): Promise<
  | ErrorOAuth2
  | {
  redirectTo: string;
  status: "OK";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { challenge: string; context?: any; grantAccessTokenAudience?: string[]; grantScope?: string[]; handledAt?: string; initialAccessTokenPayload: JSONObject | undefined; initialIdTokenPayload: JSONObject | undefined; rsub: string; sessionHandle: string; tenantId: string; userContext: UserContext; }
input.challenge string
input.context? any
input.grantAccessTokenAudience? string[]
input.grantScope? string[]
input.handledAt? string
input.initialAccessTokenPayload JSONObject | undefined
input.initialIdTokenPayload JSONObject | undefined
input.rsub string
input.sessionHandle string
input.tenantId string
input.userContext UserContext
Returns

Promise< | ErrorOAuth2 | { redirectTo: string; status: "OK"; }>

acceptLoginRequest()
acceptLoginRequest(input): Promise<
  | ErrorOAuth2
  | {
  redirectTo: string;
  status: "OK";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { acr?: string; amr?: string[]; challenge: string; context?: any; extendSessionLifespan?: boolean; identityProviderSessionId?: string; subject: string; userContext: UserContext; }
input.acr? string
input.amr? string[]
input.challenge string
input.context? any
input.extendSessionLifespan? boolean
input.identityProviderSessionId? string
input.subject string
input.userContext UserContext
Returns

Promise< | ErrorOAuth2 | { redirectTo: string; status: "OK"; }>

acceptLogoutRequest()
acceptLogoutRequest(input): Promise<
  | ErrorOAuth2
  | {
  redirectTo: string;
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { challenge: string; userContext: UserContext; }
input.challenge string
input.userContext UserContext
Returns

Promise< | ErrorOAuth2 | { redirectTo: string; }>

authorization()
authorization(input): Promise<
  | ErrorOAuth2
  | {
  cookies: string[] | undefined;
  redirectTo: string;
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { cookies: string | undefined; params: Record<string, string>; session: SessionContainerInterface | undefined; userContext: UserContext; }
input.cookies string | undefined
input.params Record<string, string>
input.session SessionContainerInterface | undefined
input.userContext UserContext
Returns

Promise< | ErrorOAuth2 | { cookies: string[] | undefined; redirectTo: string; }>

buildAccessTokenPayload()
buildAccessTokenPayload(input): Promise<JSONObject>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { client: OAuth2Client; scopes: string[]; sessionHandle: string | undefined; user: User | undefined; userContext: UserContext; }
input.client OAuth2Client
input.scopes string[]
input.sessionHandle string | undefined
input.user User | undefined
input.userContext UserContext
Returns

Promise<JSONObject>

buildIdTokenPayload()
buildIdTokenPayload(input): Promise<JSONObject>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { client: OAuth2Client; scopes: string[]; sessionHandle: string | undefined; user: User | undefined; userContext: UserContext; }
input.client OAuth2Client
input.scopes string[]
input.sessionHandle string | undefined
input.user User | undefined
input.userContext UserContext
Returns

Promise<JSONObject>

buildUserInfo()
buildUserInfo(input): Promise<JSONObject>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { accessTokenPayload: JSONObject; scopes: string[]; tenantId: string; user: User; userContext: UserContext; }
input.accessTokenPayload JSONObject
input.scopes string[]
input.tenantId string
input.user User
input.userContext UserContext
Returns

Promise<JSONObject>

createOAuth2Client()
createOAuth2Client(input): Promise<
  | {
  client: OAuth2Client;
  status: "OK";
}
  | {
  error: string;
  errorDescription: string;
  status: "ERROR";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input Partial<Omit<OAuth2ClientOptions, "createdAt" | "updatedAt">> & object
Returns

Promise< | { client: OAuth2Client; status: "OK"; } | { error: string; errorDescription: string; status: "ERROR"; }>

deleteOAuth2Client()
deleteOAuth2Client(input): Promise<
  | {
  status: "OK";
}
  | {
  error: string;
  errorDescription: string;
  status: "ERROR";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input DeleteOAuth2ClientInput & object
Returns

Promise< | { status: "OK"; } | { error: string; errorDescription: string; status: "ERROR"; }>

endSession()
endSession(input): Promise<
  | ErrorOAuth2
  | {
  redirectTo: string;
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { params: Record<string, string>; session?: SessionContainerInterface; shouldTryRefresh: boolean; userContext: UserContext; }
input.params Record<string, string>
input.session? SessionContainerInterface
input.shouldTryRefresh boolean
input.userContext UserContext
Returns

Promise< | ErrorOAuth2 | { redirectTo: string; }>

getConsentRequest()
getConsentRequest(input): Promise<ErrorOAuth2 | ConsentRequest>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { challenge: string; userContext: UserContext; }
input.challenge string
input.userContext UserContext
Returns

Promise<ErrorOAuth2 | ConsentRequest>

getFrontendRedirectionURL()
getFrontendRedirectionURL(input): Promise<string>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input | { forceFreshAuth: boolean; hint: string | undefined; loginChallenge: string; tenantId: string; type: "login"; userContext: UserContext; } | { loginChallenge: string; type: "try-refresh"; userContext: UserContext; } | { logoutChallenge: string; type: "logout-confirmation"; userContext: UserContext; } | { type: "post-logout-fallback"; userContext: UserContext; }
Returns

Promise<string>

getLoginRequest()
getLoginRequest(input): Promise<
  | ErrorOAuth2
| LoginRequest & object>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { challenge: string; userContext: UserContext; }
input.challenge string
input.userContext UserContext
Returns

Promise< | ErrorOAuth2 | LoginRequest & object>

getOAuth2Client()
getOAuth2Client(input): Promise<
  | {
  client: OAuth2Client;
  status: "OK";
}
  | {
  error: string;
  errorDescription: string;
  status: "ERROR";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { clientId: string; userContext: UserContext; }
input.clientId string
input.userContext UserContext
Returns

Promise< | { client: OAuth2Client; status: "OK"; } | { error: string; errorDescription: string; status: "ERROR"; }>

getOAuth2Clients()
getOAuth2Clients(input): Promise<
  | {
  clients: OAuth2Client[];
  nextPaginationToken?: string;
  status: "OK";
}
  | {
  error: string;
  errorDescription: string;
  status: "ERROR";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input GetOAuth2ClientsInput & object
Returns

Promise< | { clients: OAuth2Client[]; nextPaginationToken?: string; status: "OK"; } | { error: string; errorDescription: string; status: "ERROR"; }>

getRequestedScopes()
getRequestedScopes(input): Promise<string[]>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { clientId: string; recipeUserId: RecipeUserId | undefined; scopeParam: string[]; sessionHandle: string | undefined; userContext: UserContext; }
input.clientId string
input.recipeUserId RecipeUserId | undefined
input.scopeParam string[]
input.sessionHandle string | undefined
input.userContext UserContext
Returns

Promise<string[]>

introspectToken()
introspectToken(input): Promise<
  | InstrospectTokenResponse & { status: "OK"; }
| ErrorOAuth2>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { scopes?: string[]; token: string; userContext: UserContext; }
input.scopes? string[]
input.token string
input.userContext UserContext
Returns

Promise< | InstrospectTokenResponse & { status: “OK”; } | ErrorOAuth2>

rejectConsentRequest()
rejectConsentRequest(input): Promise<
  | ErrorOAuth2
  | {
  redirectTo: string;
  status: "OK";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { challenge: string; error: ErrorOAuth2; userContext: UserContext; }
input.challenge string
input.error ErrorOAuth2
input.userContext UserContext
Returns

Promise< | ErrorOAuth2 | { redirectTo: string; status: "OK"; }>

rejectLoginRequest()
rejectLoginRequest(input): Promise<
  | ErrorOAuth2
  | {
  redirectTo: string;
  status: "OK";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { challenge: string; error: ErrorOAuth2; userContext: UserContext; }
input.challenge string
input.error ErrorOAuth2
input.userContext UserContext
Returns

Promise< | ErrorOAuth2 | { redirectTo: string; status: "OK"; }>

rejectLogoutRequest()
rejectLogoutRequest(input): Promise<{
  status: "OK";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { challenge: string; userContext: UserContext; }
input.challenge string
input.userContext UserContext
Returns

Promise<{ status: "OK"; }>

revokeToken()
revokeToken(input): Promise<
  | ErrorOAuth2
  | {
  status: "OK";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input object & | { authorizationHeader: string; } | { clientId: string; clientSecret?: string; }
Returns

Promise< | ErrorOAuth2 | { status: "OK"; }>

revokeTokensByClientId()
revokeTokensByClientId(input): Promise<{
  status: "OK";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { clientId: string; userContext: UserContext; }
input.clientId string
input.userContext UserContext
Returns

Promise<{ status: "OK"; }>

revokeTokensBySessionHandle()
revokeTokensBySessionHandle(input): Promise<{
  status: "OK";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { sessionHandle: string; userContext: UserContext; }
input.sessionHandle string
input.userContext UserContext
Returns

Promise<{ status: "OK"; }>

tokenExchange()
tokenExchange(input): Promise<ErrorOAuth2 | TokenInfo>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { authorizationHeader?: string; body: Record<string, string | undefined>; userContext: UserContext; }
input.authorizationHeader? string
input.body Record<string, string | undefined>
input.userContext UserContext
Returns

Promise<ErrorOAuth2 | TokenInfo>

updateOAuth2Client()
updateOAuth2Client(input): Promise<
  | {
  client: OAuth2Client;
  status: "OK";
}
  | {
  error: string;
  errorDescription: string;
  status: "ERROR";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input NonNullableProperties<Omit<Partial<Omit<OAuth2ClientOptions, "createdAt" | "updatedAt">>, "redirectUris" | "grantTypes" | "responseTypes" | "metadata">> & object & object
Returns

Promise< | { client: OAuth2Client; status: "OK"; } | { error: string; errorDescription: string; status: "ERROR"; }>

validateOAuth2AccessToken()
validateOAuth2AccessToken(input): Promise<{
  payload: JSONObject;
  status: "OK";
}>;

Defined in: recipe/oauth2provider/types.ts

Parameters
Parameter Type
input { checkDatabase?: boolean; requirements?: { audience?: string; clientId?: string; scopes?: string[]; }; token: string; userContext: UserContext; }
input.checkDatabase? boolean
input.requirements? { audience?: string; clientId?: string; scopes?: string[]; }
input.requirements.audience? string
input.requirements.clientId? string
input.requirements.scopes? string[]
input.token string
input.userContext UserContext
Returns

Promise<{ payload: JSONObject; status: "OK"; }>


TokenInfo

type TokenInfo = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
access_token? string recipe/oauth2provider/types.ts
expires_in number recipe/oauth2provider/types.ts
id_token? string recipe/oauth2provider/types.ts
refresh_token? string recipe/oauth2provider/types.ts
scope string recipe/oauth2provider/types.ts
token_type string recipe/oauth2provider/types.ts

TypeInput

type TypeInput = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
override? object recipe/oauth2provider/types.ts
override.apis? (originalImplementation, builder) => APIInterface recipe/oauth2provider/types.ts
override.functions? (originalImplementation, builder) => RecipeInterface recipe/oauth2provider/types.ts

TypeNormalisedInput

type TypeNormalisedInput = object;

Defined in: recipe/oauth2provider/types.ts

Properties

Property Type Defined in
override object recipe/oauth2provider/types.ts
override.apis (originalImplementation, builder) => APIInterface recipe/oauth2provider/types.ts
override.functions (originalImplementation, builder) => RecipeInterface recipe/oauth2provider/types.ts

UpdateOAuth2ClientInput

type UpdateOAuth2ClientInput = NonNullableProperties<Omit<CreateOAuth2ClientInput, "redirectUris" | "grantTypes" | "responseTypes" | "metadata">> & object;

Defined in: recipe/oauth2provider/types.ts

Type Declaration

Name Type Defined in
clientId string recipe/oauth2provider/types.ts
grantTypes? string[] | null recipe/oauth2provider/types.ts
metadata? Record<string, any> | null recipe/oauth2provider/types.ts
redirectUris? string[] | null recipe/oauth2provider/types.ts
responseTypes? string[] | null recipe/oauth2provider/types.ts

UserInfo

type UserInfo = object;

Defined in: recipe/oauth2provider/types.ts

Indexable

[key: string]: JSONValue

Properties

Property Type Defined in
email? string recipe/oauth2provider/types.ts
email_verified? boolean recipe/oauth2provider/types.ts
phoneNumber? string recipe/oauth2provider/types.ts
phoneNumber_verified? boolean recipe/oauth2provider/types.ts
sub string recipe/oauth2provider/types.ts

UserInfoBuilderFunction()

type UserInfoBuilderFunction = (user, accessTokenPayload, scopes, tenantId, userContext) => Promise<JSONObject>;

Defined in: recipe/oauth2provider/types.ts

Parameters

Parameter Type
user User
accessTokenPayload JSONObject
scopes string[]
tenantId string
userContext UserContext

Returns

Promise<JSONObject>

API reference

API schema and response details