@ory/kratos-client
Version:
OpenAPI client for @ory/kratos-client
825 lines • 444 kB
JavaScript
/* tslint:disable */
/* eslint-disable */
/**
* Ory Identities API
* This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more.
*
* The version of the OpenAPI document: v1.3.8
* Contact: office@ory.sh
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
// @ts-ignore
import { BASE_PATH, BaseAPI, operationServerMap } from './base';
/**
* The authenticator assurance level can be one of \"aal1\", \"aal2\", or \"aal3\". A higher number means that it is harder for an attacker to compromise the account. Generally, \"aal1\" implies that one authentication factor was used while AAL2 implies that two factors (e.g. password + TOTP) have been used. To learn more about these levels please head over to: https://www.ory.sh/kratos/docs/concepts/credentials
* @export
* @enum {string}
*/
export const AuthenticatorAssuranceLevel = {
Aal0: 'aal0',
Aal1: 'aal1',
Aal2: 'aal2',
Aal3: 'aal3'
};
export const ConsistencyRequestParametersConsistencyEnum = {
Empty: '',
Strong: 'strong',
Eventual: 'eventual'
};
export const ContinueWithRecoveryUiActionEnum = {
ShowRecoveryUi: 'show_recovery_ui'
};
export const ContinueWithRedirectBrowserToActionEnum = {
RedirectBrowserTo: 'redirect_browser_to'
};
export const ContinueWithSetOrySessionTokenActionEnum = {
SetOrySessionToken: 'set_ory_session_token'
};
export const ContinueWithSettingsUiActionEnum = {
ShowSettingsUi: 'show_settings_ui'
};
export const ContinueWithVerificationUiActionEnum = {
ShowVerificationUi: 'show_verification_ui'
};
/**
* A Message\'s Status
* @export
* @enum {string}
*/
export const CourierMessageStatus = {
Queued: 'queued',
Sent: 'sent',
Processing: 'processing',
Abandoned: 'abandoned'
};
/**
* It can either be `email` or `phone`
* @export
* @enum {string}
*/
export const CourierMessageType = {
Email: 'email',
Phone: 'phone'
};
export const CreateIdentityBodyStateEnum = {
Active: 'active',
Inactive: 'inactive'
};
export const IdentityStateEnum = {
Active: 'active',
Inactive: 'inactive'
};
export const IdentityCredentialsTypeEnum = {
Password: 'password',
Oidc: 'oidc',
Totp: 'totp',
LookupSecret: 'lookup_secret',
Webauthn: 'webauthn',
Code: 'code',
Passkey: 'passkey',
Profile: 'profile',
Saml: 'saml',
LinkRecovery: 'link_recovery',
CodeRecovery: 'code_recovery'
};
export const IdentityPatchResponseActionEnum = {
Create: 'create',
Error: 'error'
};
export const LoginFlowActiveEnum = {
Password: 'password',
Oidc: 'oidc',
Totp: 'totp',
LookupSecret: 'lookup_secret',
Webauthn: 'webauthn',
Code: 'code',
Passkey: 'passkey',
Profile: 'profile',
Saml: 'saml',
LinkRecovery: 'link_recovery',
CodeRecovery: 'code_recovery'
};
/**
* The experimental state represents the state of a login flow. This field is EXPERIMENTAL and subject to change!
* @export
* @enum {string}
*/
export const LoginFlowState = {
ChooseMethod: 'choose_method',
SentEmail: 'sent_email',
PassedChallenge: 'passed_challenge'
};
export const MessageTemplateTypeEnum = {
RecoveryInvalid: 'recovery_invalid',
RecoveryValid: 'recovery_valid',
RecoveryCodeInvalid: 'recovery_code_invalid',
RecoveryCodeValid: 'recovery_code_valid',
VerificationInvalid: 'verification_invalid',
VerificationValid: 'verification_valid',
VerificationCodeInvalid: 'verification_code_invalid',
VerificationCodeValid: 'verification_code_valid',
Stub: 'stub',
LoginCodeValid: 'login_code_valid',
RegistrationCodeValid: 'registration_code_valid'
};
export const MessageDispatchStatusEnum = {
Failed: 'failed',
Success: 'success'
};
/**
* The experimental state represents the state of a recovery flow. This field is EXPERIMENTAL and subject to change!
* @export
* @enum {string}
*/
export const RecoveryFlowState = {
ChooseMethod: 'choose_method',
SentEmail: 'sent_email',
PassedChallenge: 'passed_challenge'
};
export const RegistrationFlowActiveEnum = {
Password: 'password',
Oidc: 'oidc',
Totp: 'totp',
LookupSecret: 'lookup_secret',
Webauthn: 'webauthn',
Code: 'code',
Passkey: 'passkey',
Profile: 'profile',
Saml: 'saml',
LinkRecovery: 'link_recovery',
CodeRecovery: 'code_recovery'
};
/**
* The experimental state represents the state of a registration flow. This field is EXPERIMENTAL and subject to change!
* @export
* @enum {string}
*/
export const RegistrationFlowState = {
ChooseMethod: 'choose_method',
SentEmail: 'sent_email',
PassedChallenge: 'passed_challenge'
};
export const SessionAuthenticationMethodMethodEnum = {
LinkRecovery: 'link_recovery',
CodeRecovery: 'code_recovery',
Password: 'password',
Code: 'code',
Totp: 'totp',
Oidc: 'oidc',
Webauthn: 'webauthn',
LookupSecret: 'lookup_secret',
V06LegacySession: 'v0.6_legacy_session'
};
/**
* The experimental state represents the state of a settings flow. This field is EXPERIMENTAL and subject to change!
* @export
* @enum {string}
*/
export const SettingsFlowState = {
ShowForm: 'show_form',
Success: 'success'
};
export const UiNodeGroupEnum = {
Default: 'default',
Password: 'password',
Oidc: 'oidc',
Profile: 'profile',
Link: 'link',
Code: 'code',
Totp: 'totp',
LookupSecret: 'lookup_secret',
Webauthn: 'webauthn',
Passkey: 'passkey',
IdentifierFirst: 'identifier_first',
Captcha: 'captcha',
Saml: 'saml'
};
export const UiNodeTypeEnum = {
Text: 'text',
Input: 'input',
Img: 'img',
A: 'a',
Script: 'script'
};
export const UiNodeAnchorAttributesNodeTypeEnum = {
Text: 'text',
Input: 'input',
Img: 'img',
A: 'a',
Script: 'script'
};
export const UiNodeImageAttributesNodeTypeEnum = {
Text: 'text',
Input: 'input',
Img: 'img',
A: 'a',
Script: 'script'
};
export const UiNodeInputAttributesAutocompleteEnum = {
Email: 'email',
Tel: 'tel',
Url: 'url',
CurrentPassword: 'current-password',
NewPassword: 'new-password',
OneTimeCode: 'one-time-code'
};
export const UiNodeInputAttributesNodeTypeEnum = {
Text: 'text',
Input: 'input',
Img: 'img',
A: 'a',
Script: 'script'
};
export const UiNodeInputAttributesOnclickTriggerEnum = {
OryWebAuthnRegistration: 'oryWebAuthnRegistration',
OryWebAuthnLogin: 'oryWebAuthnLogin',
OryPasskeyLogin: 'oryPasskeyLogin',
OryPasskeyLoginAutocompleteInit: 'oryPasskeyLoginAutocompleteInit',
OryPasskeyRegistration: 'oryPasskeyRegistration',
OryPasskeySettingsRegistration: 'oryPasskeySettingsRegistration'
};
export const UiNodeInputAttributesOnloadTriggerEnum = {
OryWebAuthnRegistration: 'oryWebAuthnRegistration',
OryWebAuthnLogin: 'oryWebAuthnLogin',
OryPasskeyLogin: 'oryPasskeyLogin',
OryPasskeyLoginAutocompleteInit: 'oryPasskeyLoginAutocompleteInit',
OryPasskeyRegistration: 'oryPasskeyRegistration',
OryPasskeySettingsRegistration: 'oryPasskeySettingsRegistration'
};
export const UiNodeInputAttributesTypeEnum = {
Text: 'text',
Password: 'password',
Number: 'number',
Checkbox: 'checkbox',
Hidden: 'hidden',
Email: 'email',
Tel: 'tel',
Submit: 'submit',
Button: 'button',
DatetimeLocal: 'datetime-local',
Date: 'date',
Url: 'url'
};
export const UiNodeScriptAttributesNodeTypeEnum = {
Text: 'text',
Input: 'input',
Img: 'img',
A: 'a',
Script: 'script'
};
export const UiNodeTextAttributesNodeTypeEnum = {
Text: 'text',
Input: 'input',
Img: 'img',
A: 'a',
Script: 'script'
};
export const UiTextTypeEnum = {
Info: 'info',
Error: 'error',
Success: 'success'
};
export const UpdateIdentityBodyStateEnum = {
Active: 'active',
Inactive: 'inactive'
};
export const UpdateRecoveryFlowWithCodeMethodMethodEnum = {
Link: 'link',
Code: 'code'
};
export const UpdateRecoveryFlowWithLinkMethodMethodEnum = {
Link: 'link',
Code: 'code'
};
export const UpdateRegistrationFlowWithProfileMethodScreenEnum = {
CredentialSelection: 'credential-selection',
Previous: 'previous'
};
export const UpdateVerificationFlowWithCodeMethodMethodEnum = {
Link: 'link',
Code: 'code'
};
export const UpdateVerificationFlowWithLinkMethodMethodEnum = {
Link: 'link',
Code: 'code'
};
export const VerifiableIdentityAddressViaEnum = {
Email: 'email',
Sms: 'sms'
};
/**
* The experimental state represents the state of a verification flow. This field is EXPERIMENTAL and subject to change!
* @export
* @enum {string}
*/
export const VerificationFlowState = {
ChooseMethod: 'choose_method',
SentEmail: 'sent_email',
PassedChallenge: 'passed_challenge'
};
/**
* CourierApi - axios parameter creator
* @export
*/
export const CourierApiAxiosParamCreator = function (configuration) {
return {
/**
* Gets a specific messages by the given ID.
* @summary Get a Message
* @param {string} id MessageID is the ID of the message.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCourierMessage: (id_1, ...args_1) => __awaiter(this, [id_1, ...args_1], void 0, function* (id, options = {}) {
// verify required parameter 'id' is not null or undefined
assertParamExists('getCourierMessage', 'id', id);
const localVarPath = `/admin/courier/messages/{id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication oryAccessToken required
yield setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Lists all messages by given status and recipient.
* @summary List Messages
* @param {number} [pageSize] Items per Page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
* @param {string} [pageToken] Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
* @param {CourierMessageStatus} [status] Status filters out messages based on status. If no value is provided, it doesn\'t take effect on filter.
* @param {string} [recipient] Recipient filters out messages based on recipient. If no value is provided, it doesn\'t take effect on filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listCourierMessages: (pageSize_1, pageToken_1, status_1, recipient_1, ...args_1) => __awaiter(this, [pageSize_1, pageToken_1, status_1, recipient_1, ...args_1], void 0, function* (pageSize, pageToken, status, recipient, options = {}) {
const localVarPath = `/admin/courier/messages`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication oryAccessToken required
yield setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
if (pageSize !== undefined) {
localVarQueryParameter['page_size'] = pageSize;
}
if (pageToken !== undefined) {
localVarQueryParameter['page_token'] = pageToken;
}
if (status !== undefined) {
localVarQueryParameter['status'] = status;
}
if (recipient !== undefined) {
localVarQueryParameter['recipient'] = recipient;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
/**
* CourierApi - functional programming interface
* @export
*/
export const CourierApiFp = function (configuration) {
const localVarAxiosParamCreator = CourierApiAxiosParamCreator(configuration);
return {
/**
* Gets a specific messages by the given ID.
* @summary Get a Message
* @param {string} id MessageID is the ID of the message.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCourierMessage(id, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getCourierMessage(id, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['CourierApi.getCourierMessage']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Lists all messages by given status and recipient.
* @summary List Messages
* @param {number} [pageSize] Items per Page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
* @param {string} [pageToken] Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
* @param {CourierMessageStatus} [status] Status filters out messages based on status. If no value is provided, it doesn\'t take effect on filter.
* @param {string} [recipient] Recipient filters out messages based on recipient. If no value is provided, it doesn\'t take effect on filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listCourierMessages(pageSize, pageToken, status, recipient, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.listCourierMessages(pageSize, pageToken, status, recipient, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['CourierApi.listCourierMessages']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
};
};
/**
* CourierApi - factory interface
* @export
*/
export const CourierApiFactory = function (configuration, basePath, axios) {
const localVarFp = CourierApiFp(configuration);
return {
/**
* Gets a specific messages by the given ID.
* @summary Get a Message
* @param {CourierApiGetCourierMessageRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCourierMessage(requestParameters, options) {
return localVarFp.getCourierMessage(requestParameters.id, options).then((request) => request(axios, basePath));
},
/**
* Lists all messages by given status and recipient.
* @summary List Messages
* @param {CourierApiListCourierMessagesRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listCourierMessages(requestParameters = {}, options) {
return localVarFp.listCourierMessages(requestParameters.pageSize, requestParameters.pageToken, requestParameters.status, requestParameters.recipient, options).then((request) => request(axios, basePath));
},
};
};
/**
* CourierApi - object-oriented interface
* @export
* @class CourierApi
* @extends {BaseAPI}
*/
export class CourierApi extends BaseAPI {
/**
* Gets a specific messages by the given ID.
* @summary Get a Message
* @param {CourierApiGetCourierMessageRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CourierApi
*/
getCourierMessage(requestParameters, options) {
return CourierApiFp(this.configuration).getCourierMessage(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
}
/**
* Lists all messages by given status and recipient.
* @summary List Messages
* @param {CourierApiListCourierMessagesRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CourierApi
*/
listCourierMessages(requestParameters = {}, options) {
return CourierApiFp(this.configuration).listCourierMessages(requestParameters.pageSize, requestParameters.pageToken, requestParameters.status, requestParameters.recipient, options).then((request) => request(this.axios, this.basePath));
}
}
/**
* FrontendApi - axios parameter creator
* @export
*/
export const FrontendApiAxiosParamCreator = function (configuration) {
return {
/**
* This endpoint initializes a browser-based user login flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to `selfservice.flows.login.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists already, the browser will be redirected to `urls.default_redirect_url` unless the query parameter `?refresh=true` was set. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `session_aal1_required`: Multi-factor auth (e.g. 2fa) was requested but the user has no session yet. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! The optional query parameter login_challenge is set when using Kratos with Hydra in an OAuth2 flow. See the oauth2_provider.url configuration option. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
* @summary Create Login Flow for Browsers
* @param {boolean} [refresh] Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session.
* @param {string} [aal] Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session\'s authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session\'s security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\".
* @param {string} [returnTo] The URL to return the browser to after the flow was completed.
* @param {string} [cookie] HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
* @param {string} [loginChallenge] An optional Hydra login challenge. If present, Kratos will cooperate with Ory Hydra to act as an OAuth2 identity provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/login?login_challenge=abcde`).
* @param {string} [organization] An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network.
* @param {string} [via] Via should contain the identity\'s credential the code should be sent to. Only relevant in aal2 flows. DEPRECATED: This field is deprecated. Please remove it from your requests. The user will now see a choice of MFA credentials to choose from to perform the second factor instead.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBrowserLoginFlow: (refresh_1, aal_1, returnTo_1, cookie_1, loginChallenge_1, organization_1, via_1, ...args_1) => __awaiter(this, [refresh_1, aal_1, returnTo_1, cookie_1, loginChallenge_1, organization_1, via_1, ...args_1], void 0, function* (refresh, aal, returnTo, cookie, loginChallenge, organization, via, options = {}) {
const localVarPath = `/self-service/login/browser`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (refresh !== undefined) {
localVarQueryParameter['refresh'] = refresh;
}
if (aal !== undefined) {
localVarQueryParameter['aal'] = aal;
}
if (returnTo !== undefined) {
localVarQueryParameter['return_to'] = returnTo;
}
if (loginChallenge !== undefined) {
localVarQueryParameter['login_challenge'] = loginChallenge;
}
if (organization !== undefined) {
localVarQueryParameter['organization'] = organization;
}
if (via !== undefined) {
localVarQueryParameter['via'] = via;
}
if (cookie != null) {
localVarHeaderParameter['Cookie'] = String(cookie);
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* This endpoint initializes a browser-based user logout flow and a URL which can be used to log out the user. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). For API clients you can call the `/self-service/logout/api` URL directly with the Ory Session Token. The URL is only valid for the currently signed in user. If no user is signed in, this endpoint returns a 401 error. When calling this endpoint from a backend, please ensure to properly forward the HTTP cookies.
* @summary Create a Logout URL for Browsers
* @param {string} [cookie] HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request.
* @param {string} [returnTo] Return to URL The URL to which the browser should be redirected to after the logout has been performed.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBrowserLogoutFlow: (cookie_1, returnTo_1, ...args_1) => __awaiter(this, [cookie_1, returnTo_1, ...args_1], void 0, function* (cookie, returnTo, options = {}) {
const localVarPath = `/self-service/logout/browser`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (returnTo !== undefined) {
localVarQueryParameter['return_to'] = returnTo;
}
if (cookie != null) {
localVarHeaderParameter['cookie'] = String(cookie);
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to `selfservice.flows.recovery.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists, the browser is returned to the configured return URL. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects or a 400 bad request error if the user is already authenticated. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery).
* @summary Create Recovery Flow for Browsers
* @param {string} [returnTo] The URL to return the browser to after the flow was completed.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBrowserRecoveryFlow: (returnTo_1, ...args_1) => __awaiter(this, [returnTo_1, ...args_1], void 0, function* (returnTo, options = {}) {
const localVarPath = `/self-service/recovery/browser`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (returnTo !== undefined) {
localVarQueryParameter['return_to'] = returnTo;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* This endpoint initializes a browser-based user registration flow. This endpoint will set the appropriate cookies and anti-CSRF measures required for browser-based flows. If this endpoint is opened as a link in the browser, it will be redirected to `selfservice.flows.registration.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists already, the browser will be redirected to `urls.default_redirect_url`. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! If this endpoint is called via an AJAX request, the response contains the registration flow without a redirect. This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
* @summary Create Registration Flow for Browsers
* @param {string} [returnTo] The URL to return the browser to after the flow was completed.
* @param {string} [loginChallenge] Ory OAuth 2.0 Login Challenge. If set will cooperate with Ory OAuth2 and OpenID to act as an OAuth2 server / OpenID Provider. The value for this parameter comes from `login_challenge` URL Query parameter sent to your application (e.g. `/registration?login_challenge=abcde`). This feature is compatible with Ory Hydra when not running on the Ory Network.
* @param {string} [afterVerificationReturnTo] The URL to return the browser to after the verification flow was completed. After the registration flow is completed, the user will be sent a verification email. Upon completing the verification flow, this URL will be used to override the default `selfservice.flows.verification.after.default_redirect_to` value.
* @param {string} [organization] An optional organization ID that should be used to register this user. This parameter is only effective in the Ory Network.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBrowserRegistrationFlow: (returnTo_1, loginChallenge_1, afterVerificationReturnTo_1, organization_1, ...args_1) => __awaiter(this, [returnTo_1, loginChallenge_1, afterVerificationReturnTo_1, organization_1, ...args_1], void 0, function* (returnTo, loginChallenge, afterVerificationReturnTo, organization, options = {}) {
const localVarPath = `/self-service/registration/browser`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (returnTo !== undefined) {
localVarQueryParameter['return_to'] = returnTo;
}
if (loginChallenge !== undefined) {
localVarQueryParameter['login_challenge'] = loginChallenge;
}
if (afterVerificationReturnTo !== undefined) {
localVarQueryParameter['after_verification_return_to'] = afterVerificationReturnTo;
}
if (organization !== undefined) {
localVarQueryParameter['organization'] = organization;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid Ory Kratos Session Cookie is included in the request, a login flow will be initialized. If this endpoint is opened as a link in the browser, it will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid user session was set, the browser will be redirected to the login endpoint. If this endpoint is called via an AJAX request, the response contains the settings flow without any redirects or a 401 forbidden error if no valid session was set. Depending on your configuration this endpoint might return a 403 error if the session has a lower Authenticator Assurance Level (AAL) than is possible for the identity. This can happen if the identity has password + webauthn credentials (which would result in AAL2) but the session has only AAL1. If this error occurs, ask the user to sign in with the second factor (happens automatically for server-side browser flows) or change the configuration. If this endpoint is called via an AJAX request, the response contains the flow without a redirect. In the case of an error, the `error.id` of the JSON response body can be one of: `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. `session_inactive`: No Ory Session was found - sign in a user first. `security_identity_mismatch`: The requested `?return_to` address is not allowed to be used. Adjust this in the configuration! This endpoint is NOT INTENDED for clients that do not have a browser (Chrome, Firefox, ...) as cookies are needed. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
* @summary Create Settings Flow for Browsers
* @param {string} [returnTo] The URL to return the browser to after the flow was completed.
* @param {string} [cookie] HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBrowserSettingsFlow: (returnTo_1, cookie_1, ...args_1) => __awaiter(this, [returnTo_1, cookie_1, ...args_1], void 0, function* (returnTo, cookie, options = {}) {
const localVarPath = `/self-service/settings/browser`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (returnTo !== undefined) {
localVarQueryParameter['return_to'] = returnTo;
}
if (cookie != null) {
localVarHeaderParameter['Cookie'] = String(cookie);
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to `selfservice.flows.verification.ui_url` with the flow ID set as the query parameter `?flow=`. If this endpoint is called via an AJAX request, the response contains the recovery flow without any redirects. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation).
* @summary Create Verification Flow for Browser Clients
* @param {string} [returnTo] The URL to return the browser to after the flow was completed.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBrowserVerificationFlow: (returnTo_1, ...args_1) => __awaiter(this, [returnTo_1, ...args_1], void 0, function* (returnTo, options = {}) {
const localVarPath = `/self-service/verification/browser`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (returnTo !== undefined) {
localVarQueryParameter['return_to'] = returnTo;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* This endpoint returns a list of all available FedCM providers. It is only supported on the Ory Network.
* @summary Get FedCM Parameters
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createFedcmFlow: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) {
const localVarPath = `/self-service/fed-cm/parameters`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* This endpoint initiates a login flow for native apps that do not use a browser, such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. To fetch an existing login flow call `/self-service/login/flows?flow=<flow_id>`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks, including CSRF login attacks. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `session_aal1_required`: Multi-factor auth (e.g. 2fa) was requested but the user has no session yet. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration).
* @summary Create Login Flow for Native Apps
* @param {boolean} [refresh] Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session.
* @param {string} [aal] Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session\'s authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session\'s security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\".
* @param {string} [xSessionToken] The Session Token of the Identity performing the settings flow.
* @param {boolean} [returnSessionTokenExchangeCode] EnableSessionTokenExchangeCode requests the login flow to include a code that can be used to retrieve the session token after the login flow has been completed.
* @param {string} [returnTo] The URL to return the browser to after the flow was completed.
* @param {string} [organization] An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network.
* @param {string} [via] Via should contain the identity\'s credential the code should be sent to. Only relevant in aal2 flows. DEPRECATED: This field is deprecated. Please remove it from your requests. The user will now see a choice of MFA credentials to choose from to perform the second factor instead.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createNativeLoginFlow: (refresh_1, aal_1, xSessionToken_1, returnSessionTokenExchangeCode_1, returnTo_1, organization_1, via_1, ...args_1) => __awaiter(this, [refresh_1, aal_1, xSessionToken_1, returnSessionTokenExchangeCode_1, returnTo_1, organization_1, via_1, ...args_1], void 0, function* (refresh, aal, xSessionToken, returnSessionTokenExchangeCode, returnTo, organization, via, options = {}) {
const localVarPath = `/self-service/login/api`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (refresh !== undefined) {
localVarQueryParameter['refresh'] = refresh;
}
if (aal !== undefined) {
localVarQueryParameter['aal'] = aal;
}
if (returnSessionTokenExchangeCode !== undefined) {
localVarQueryParameter['return_session_token_exchange_code'] = returnSessionTokenExchangeCode;
}
if (returnTo !== undefined) {
localVarQueryParameter['return_to'] = returnTo;
}
if (organization !== undefined) {
localVarQueryParameter['organization'] = organization;
}
if (via !== undefined) {
localVarQueryParameter['via'] = via;
}
if (xSessionToken != null) {
localVarHeaderParameter['X-Session-Token'] = String(xSessionToken);
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error. On an existing recovery flow, use the `getRecoveryFlow` API endpoint. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery).
* @summary Create Recovery Fl