Skip to content

Latest commit

 

History

History
2934 lines (2368 loc) · 150 KB

FrontendApi.md

File metadata and controls

2934 lines (2368 loc) · 150 KB

Ory.Kratos.Client.Api.FrontendApi

All URIs are relative to http://localhost

Method HTTP request Description
CreateBrowserLoginFlow GET /self-service/login/browser Create Login Flow for Browsers
CreateBrowserLogoutFlow GET /self-service/logout/browser Create a Logout URL for Browsers
CreateBrowserRecoveryFlow GET /self-service/recovery/browser Create Recovery Flow for Browsers
CreateBrowserRegistrationFlow GET /self-service/registration/browser Create Registration Flow for Browsers
CreateBrowserSettingsFlow GET /self-service/settings/browser Create Settings Flow for Browsers
CreateBrowserVerificationFlow GET /self-service/verification/browser Create Verification Flow for Browser Clients
CreateNativeLoginFlow GET /self-service/login/api Create Login Flow for Native Apps
CreateNativeRecoveryFlow GET /self-service/recovery/api Create Recovery Flow for Native Apps
CreateNativeRegistrationFlow GET /self-service/registration/api Create Registration Flow for Native Apps
CreateNativeSettingsFlow GET /self-service/settings/api Create Settings Flow for Native Apps
CreateNativeVerificationFlow GET /self-service/verification/api Create Verification Flow for Native Apps
DisableMyOtherSessions DELETE /sessions Disable my other sessions
DisableMySession DELETE /sessions/{id} Disable one of my sessions
ExchangeSessionToken GET /sessions/token-exchange Exchange Session Token
GetFlowError GET /self-service/errors Get User-Flow Errors
GetLoginFlow GET /self-service/login/flows Get Login Flow
GetRecoveryFlow GET /self-service/recovery/flows Get Recovery Flow
GetRegistrationFlow GET /self-service/registration/flows Get Registration Flow
GetSettingsFlow GET /self-service/settings/flows Get Settings Flow
GetVerificationFlow GET /self-service/verification/flows Get Verification Flow
GetWebAuthnJavaScript GET /.well-known/ory/webauthn.js Get WebAuthn JavaScript
ListMySessions GET /sessions Get My Active Sessions
PerformNativeLogout DELETE /self-service/logout/api Perform Logout for Native Apps
ToSession GET /sessions/whoami Check Who the Current HTTP Session Belongs To
UpdateLoginFlow POST /self-service/login Submit a Login Flow
UpdateLogoutFlow GET /self-service/logout Update Logout Flow
UpdateRecoveryFlow POST /self-service/recovery Update Recovery Flow
UpdateRegistrationFlow POST /self-service/registration Update Registration Flow
UpdateSettingsFlow POST /self-service/settings Complete Settings Flow
UpdateVerificationFlow POST /self-service/verification Complete Verification Flow

CreateBrowserLoginFlow

KratosLoginFlow CreateBrowserLoginFlow (bool? refresh = null, string? aal = null, string? returnTo = null, string? cookie = null, string? loginChallenge = null, string? organization = null, string? via = null)

Create Login Flow for Browsers

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 and User Registration Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateBrowserLoginFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var refresh = true;  // bool? | 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. (optional) 
            var aal = "aal_example";  // string? | 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\". (optional) 
            var returnTo = "returnTo_example";  // string? | The URL to return the browser to after the flow was completed. (optional) 
            var cookie = "cookie_example";  // string? | 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. (optional) 
            var loginChallenge = "loginChallenge_example";  // string? | 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`). (optional) 
            var organization = "organization_example";  // string? | An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. (optional) 
            var via = "via_example";  // string? | Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. (optional) 

            try
            {
                // Create Login Flow for Browsers
                KratosLoginFlow result = apiInstance.CreateBrowserLoginFlow(refresh, aal, returnTo, cookie, loginChallenge, organization, via);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateBrowserLoginFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateBrowserLoginFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Login Flow for Browsers
    ApiResponse<KratosLoginFlow> response = apiInstance.CreateBrowserLoginFlowWithHttpInfo(refresh, aal, returnTo, cookie, loginChallenge, organization, via);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateBrowserLoginFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
refresh bool? 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. [optional]
aal string? 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 &quot;upgrade&quot; the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to &quot;aal2&quot;. [optional]
returnTo string? The URL to return the browser to after the flow was completed. [optional]
cookie string? 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. [optional]
loginChallenge string? 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`). [optional]
organization string? An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. [optional]
via string? Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. [optional]

Return type

KratosLoginFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 loginFlow -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateBrowserLogoutFlow

KratosLogoutFlow CreateBrowserLogoutFlow (string? cookie = null, string? returnTo = null)

Create a Logout URL for Browsers

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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateBrowserLogoutFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var cookie = "cookie_example";  // string? | HTTP Cookies  If you call this endpoint from a backend, please include the original Cookie header in the request. (optional) 
            var returnTo = "returnTo_example";  // string? | Return to URL  The URL to which the browser should be redirected to after the logout has been performed. (optional) 

            try
            {
                // Create a Logout URL for Browsers
                KratosLogoutFlow result = apiInstance.CreateBrowserLogoutFlow(cookie, returnTo);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateBrowserLogoutFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateBrowserLogoutFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create a Logout URL for Browsers
    ApiResponse<KratosLogoutFlow> response = apiInstance.CreateBrowserLogoutFlowWithHttpInfo(cookie, returnTo);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateBrowserLogoutFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
cookie string? HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request. [optional]
returnTo string? Return to URL The URL to which the browser should be redirected to after the logout has been performed. [optional]

Return type

KratosLogoutFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 logoutFlow -
400 errorGeneric -
401 errorGeneric -
500 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateBrowserRecoveryFlow

KratosRecoveryFlow CreateBrowserRecoveryFlow (string? returnTo = null)

Create Recovery Flow for Browsers

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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateBrowserRecoveryFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var returnTo = "returnTo_example";  // string? | The URL to return the browser to after the flow was completed. (optional) 

            try
            {
                // Create Recovery Flow for Browsers
                KratosRecoveryFlow result = apiInstance.CreateBrowserRecoveryFlow(returnTo);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateBrowserRecoveryFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateBrowserRecoveryFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Recovery Flow for Browsers
    ApiResponse<KratosRecoveryFlow> response = apiInstance.CreateBrowserRecoveryFlowWithHttpInfo(returnTo);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateBrowserRecoveryFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
returnTo string? The URL to return the browser to after the flow was completed. [optional]

Return type

KratosRecoveryFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 recoveryFlow -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateBrowserRegistrationFlow

KratosRegistrationFlow CreateBrowserRegistrationFlow (string? returnTo = null, string? loginChallenge = null, string? afterVerificationReturnTo = null, string? organization = null)

Create Registration Flow for Browsers

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 and User Registration Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateBrowserRegistrationFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var returnTo = "returnTo_example";  // string? | The URL to return the browser to after the flow was completed. (optional) 
            var loginChallenge = "loginChallenge_example";  // string? | 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. (optional) 
            var afterVerificationReturnTo = "afterVerificationReturnTo_example";  // string? | 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. (optional) 
            var organization = "organization_example";  // string? |  (optional) 

            try
            {
                // Create Registration Flow for Browsers
                KratosRegistrationFlow result = apiInstance.CreateBrowserRegistrationFlow(returnTo, loginChallenge, afterVerificationReturnTo, organization);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateBrowserRegistrationFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateBrowserRegistrationFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Registration Flow for Browsers
    ApiResponse<KratosRegistrationFlow> response = apiInstance.CreateBrowserRegistrationFlowWithHttpInfo(returnTo, loginChallenge, afterVerificationReturnTo, organization);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateBrowserRegistrationFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
returnTo string? The URL to return the browser to after the flow was completed. [optional]
loginChallenge string? 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. [optional]
afterVerificationReturnTo string? 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. [optional]
organization string? [optional]

Return type

KratosRegistrationFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 registrationFlow -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateBrowserSettingsFlow

KratosSettingsFlow CreateBrowserSettingsFlow (string? returnTo = null, string? cookie = null)

Create Settings Flow for Browsers

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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateBrowserSettingsFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var returnTo = "returnTo_example";  // string? | The URL to return the browser to after the flow was completed. (optional) 
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Create Settings Flow for Browsers
                KratosSettingsFlow result = apiInstance.CreateBrowserSettingsFlow(returnTo, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateBrowserSettingsFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateBrowserSettingsFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Settings Flow for Browsers
    ApiResponse<KratosSettingsFlow> response = apiInstance.CreateBrowserSettingsFlowWithHttpInfo(returnTo, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateBrowserSettingsFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
returnTo string? The URL to return the browser to after the flow was completed. [optional]
cookie string? 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. [optional]

Return type

KratosSettingsFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 settingsFlow -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 errorGeneric -
401 errorGeneric -
403 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateBrowserVerificationFlow

KratosVerificationFlow CreateBrowserVerificationFlow (string? returnTo = null)

Create Verification Flow for Browser Clients

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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateBrowserVerificationFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var returnTo = "returnTo_example";  // string? | The URL to return the browser to after the flow was completed. (optional) 

            try
            {
                // Create Verification Flow for Browser Clients
                KratosVerificationFlow result = apiInstance.CreateBrowserVerificationFlow(returnTo);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateBrowserVerificationFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateBrowserVerificationFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Verification Flow for Browser Clients
    ApiResponse<KratosVerificationFlow> response = apiInstance.CreateBrowserVerificationFlowWithHttpInfo(returnTo);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateBrowserVerificationFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
returnTo string? The URL to return the browser to after the flow was completed. [optional]

Return type

KratosVerificationFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 verificationFlow -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateNativeLoginFlow

KratosLoginFlow CreateNativeLoginFlow (bool? refresh = null, string? aal = null, string? xSessionToken = null, bool? returnSessionTokenExchangeCode = null, string? returnTo = null, string? via = null)

Create Login Flow for Native Apps

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 and User Registration Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateNativeLoginFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var refresh = true;  // bool? | 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. (optional) 
            var aal = "aal_example";  // string? | 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\". (optional) 
            var xSessionToken = "xSessionToken_example";  // string? | The Session Token of the Identity performing the settings flow. (optional) 
            var returnSessionTokenExchangeCode = true;  // bool? | 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. (optional) 
            var returnTo = "returnTo_example";  // string? | The URL to return the browser to after the flow was completed. (optional) 
            var via = "via_example";  // string? | Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. (optional) 

            try
            {
                // Create Login Flow for Native Apps
                KratosLoginFlow result = apiInstance.CreateNativeLoginFlow(refresh, aal, xSessionToken, returnSessionTokenExchangeCode, returnTo, via);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateNativeLoginFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateNativeLoginFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Login Flow for Native Apps
    ApiResponse<KratosLoginFlow> response = apiInstance.CreateNativeLoginFlowWithHttpInfo(refresh, aal, xSessionToken, returnSessionTokenExchangeCode, returnTo, via);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateNativeLoginFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
refresh bool? 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. [optional]
aal string? 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 &quot;upgrade&quot; the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to &quot;aal2&quot;. [optional]
xSessionToken string? The Session Token of the Identity performing the settings flow. [optional]
returnSessionTokenExchangeCode bool? 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. [optional]
returnTo string? The URL to return the browser to after the flow was completed. [optional]
via string? Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. [optional]

Return type

KratosLoginFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 loginFlow -
400 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateNativeRecoveryFlow

KratosRecoveryFlow CreateNativeRecoveryFlow ()

Create Recovery Flow for Native Apps

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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateNativeRecoveryFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);

            try
            {
                // Create Recovery Flow for Native Apps
                KratosRecoveryFlow result = apiInstance.CreateNativeRecoveryFlow();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateNativeRecoveryFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateNativeRecoveryFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Recovery Flow for Native Apps
    ApiResponse<KratosRecoveryFlow> response = apiInstance.CreateNativeRecoveryFlowWithHttpInfo();
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateNativeRecoveryFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

This endpoint does not need any parameter.

Return type

KratosRecoveryFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 recoveryFlow -
400 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateNativeRegistrationFlow

KratosRegistrationFlow CreateNativeRegistrationFlow (bool? returnSessionTokenExchangeCode = null, string? returnTo = null)

Create Registration Flow for Native Apps

This endpoint initiates a registration 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 will be returned unless the URL query parameter ?refresh=true is set. To fetch an existing registration flow call /self-service/registration/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. 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. 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 and User Registration Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateNativeRegistrationFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var returnSessionTokenExchangeCode = true;  // bool? | 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. (optional) 
            var returnTo = "returnTo_example";  // string? | The URL to return the browser to after the flow was completed. (optional) 

            try
            {
                // Create Registration Flow for Native Apps
                KratosRegistrationFlow result = apiInstance.CreateNativeRegistrationFlow(returnSessionTokenExchangeCode, returnTo);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateNativeRegistrationFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateNativeRegistrationFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Registration Flow for Native Apps
    ApiResponse<KratosRegistrationFlow> response = apiInstance.CreateNativeRegistrationFlowWithHttpInfo(returnSessionTokenExchangeCode, returnTo);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateNativeRegistrationFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
returnSessionTokenExchangeCode bool? 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. [optional]
returnTo string? The URL to return the browser to after the flow was completed. [optional]

Return type

KratosRegistrationFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 registrationFlow -
400 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateNativeSettingsFlow

KratosSettingsFlow CreateNativeSettingsFlow (string? xSessionToken = null)

Create Settings Flow for Native Apps

This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. You must provide a valid Ory Kratos Session Token for this endpoint to respond with HTTP 200 OK. To fetch an existing settings flow call /self-service/settings/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. 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 or change the configuration. 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. 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 Settings & Profile Management Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateNativeSettingsFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var xSessionToken = "xSessionToken_example";  // string? | The Session Token of the Identity performing the settings flow. (optional) 

            try
            {
                // Create Settings Flow for Native Apps
                KratosSettingsFlow result = apiInstance.CreateNativeSettingsFlow(xSessionToken);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateNativeSettingsFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateNativeSettingsFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Settings Flow for Native Apps
    ApiResponse<KratosSettingsFlow> response = apiInstance.CreateNativeSettingsFlowWithHttpInfo(xSessionToken);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateNativeSettingsFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
xSessionToken string? The Session Token of the Identity performing the settings flow. [optional]

Return type

KratosSettingsFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 settingsFlow -
400 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateNativeVerificationFlow

KratosVerificationFlow CreateNativeVerificationFlow ()

Create Verification Flow for Native Apps

This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. To fetch an existing verification flow call /self-service/verification/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. 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 Email and Phone Verification Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class CreateNativeVerificationFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);

            try
            {
                // Create Verification Flow for Native Apps
                KratosVerificationFlow result = apiInstance.CreateNativeVerificationFlow();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.CreateNativeVerificationFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateNativeVerificationFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create Verification Flow for Native Apps
    ApiResponse<KratosVerificationFlow> response = apiInstance.CreateNativeVerificationFlowWithHttpInfo();
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.CreateNativeVerificationFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

This endpoint does not need any parameter.

Return type

KratosVerificationFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 verificationFlow -
400 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DisableMyOtherSessions

KratosDeleteMySessionsCount DisableMyOtherSessions (string? xSessionToken = null, string? cookie = null)

Disable my other sessions

Calling this endpoint invalidates all except the current session that belong to the logged-in user. Session data are not deleted.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class DisableMyOtherSessionsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var xSessionToken = "xSessionToken_example";  // string? | Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. (optional) 
            var cookie = "cookie_example";  // string? | Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`.  It is ok if more than one cookie are included here as all other cookies will be ignored. (optional) 

            try
            {
                // Disable my other sessions
                KratosDeleteMySessionsCount result = apiInstance.DisableMyOtherSessions(xSessionToken, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.DisableMyOtherSessions: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DisableMyOtherSessionsWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Disable my other sessions
    ApiResponse<KratosDeleteMySessionsCount> response = apiInstance.DisableMyOtherSessionsWithHttpInfo(xSessionToken, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.DisableMyOtherSessionsWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
xSessionToken string? Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. [optional]
cookie string? Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. [optional]

Return type

KratosDeleteMySessionsCount

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 deleteMySessionsCount -
400 errorGeneric -
401 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DisableMySession

void DisableMySession (string id, string? xSessionToken = null, string? cookie = null)

Disable one of my sessions

Calling this endpoint invalidates the specified session. The current session cannot be revoked. Session data are not deleted.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class DisableMySessionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var id = "id_example";  // string | ID is the session's ID.
            var xSessionToken = "xSessionToken_example";  // string? | Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. (optional) 
            var cookie = "cookie_example";  // string? | Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`.  It is ok if more than one cookie are included here as all other cookies will be ignored. (optional) 

            try
            {
                // Disable one of my sessions
                apiInstance.DisableMySession(id, xSessionToken, cookie);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.DisableMySession: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DisableMySessionWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Disable one of my sessions
    apiInstance.DisableMySessionWithHttpInfo(id, xSessionToken, cookie);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.DisableMySessionWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string ID is the session's ID.
xSessionToken string? Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. [optional]
cookie string? Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. [optional]

Return type

void (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 errorGeneric -
401 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ExchangeSessionToken

KratosSuccessfulNativeLogin ExchangeSessionToken (string initCode, string returnToCode)

Exchange Session Token

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class ExchangeSessionTokenExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var initCode = "initCode_example";  // string | The part of the code return when initializing the flow.
            var returnToCode = "returnToCode_example";  // string | The part of the code returned by the return_to URL.

            try
            {
                // Exchange Session Token
                KratosSuccessfulNativeLogin result = apiInstance.ExchangeSessionToken(initCode, returnToCode);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.ExchangeSessionToken: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the ExchangeSessionTokenWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Exchange Session Token
    ApiResponse<KratosSuccessfulNativeLogin> response = apiInstance.ExchangeSessionTokenWithHttpInfo(initCode, returnToCode);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.ExchangeSessionTokenWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
initCode string The part of the code return when initializing the flow.
returnToCode string The part of the code returned by the return_to URL.

Return type

KratosSuccessfulNativeLogin

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successfulNativeLogin -
403 errorGeneric -
404 errorGeneric -
410 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetFlowError

KratosFlowError GetFlowError (string id)

Get User-Flow Errors

This endpoint returns the error associated with a user-facing self service errors. This endpoint supports stub values to help you implement the error UI: ?id=stub:500 - returns a stub 500 (Internal Server Error) error. More information can be found at Ory Kratos User User Facing Error Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class GetFlowErrorExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var id = "id_example";  // string | Error is the error's ID

            try
            {
                // Get User-Flow Errors
                KratosFlowError result = apiInstance.GetFlowError(id);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.GetFlowError: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetFlowErrorWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get User-Flow Errors
    ApiResponse<KratosFlowError> response = apiInstance.GetFlowErrorWithHttpInfo(id);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.GetFlowErrorWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string Error is the error's ID

Return type

KratosFlowError

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 flowError -
403 errorGeneric -
404 errorGeneric -
500 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetLoginFlow

KratosLoginFlow GetLoginFlow (string id, string? cookie = null)

Get Login Flow

This endpoint returns a login flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: js pseudo-code example router.get('/login', async function (req, res) { const flow = await client.getLoginFlow(req.header('cookie'), req.query['flow']) res.render('login', flow) }) This request may fail due to several reasons. The error.id can be one of: session_already_available: The user is already signed in. self_service_flow_expired: The flow is expired and you should request a new one. More information can be found at Ory Kratos User Login and User Registration Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class GetLoginFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var id = "id_example";  // string | The Login Flow ID  The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`).
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Get Login Flow
                KratosLoginFlow result = apiInstance.GetLoginFlow(id, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.GetLoginFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetLoginFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get Login Flow
    ApiResponse<KratosLoginFlow> response = apiInstance.GetLoginFlowWithHttpInfo(id, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.GetLoginFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string The Login Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`).
cookie string? 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. [optional]

Return type

KratosLoginFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 loginFlow -
403 errorGeneric -
404 errorGeneric -
410 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetRecoveryFlow

KratosRecoveryFlow GetRecoveryFlow (string id, string? cookie = null)

Get Recovery Flow

This endpoint returns a recovery flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: js pseudo-code example router.get('/recovery', async function (req, res) { const flow = await client.getRecoveryFlow(req.header('Cookie'), req.query['flow']) res.render('recovery', flow) }) More information can be found at Ory Kratos Account Recovery Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class GetRecoveryFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var id = "id_example";  // string | The Flow ID  The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`).
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Get Recovery Flow
                KratosRecoveryFlow result = apiInstance.GetRecoveryFlow(id, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.GetRecoveryFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetRecoveryFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get Recovery Flow
    ApiResponse<KratosRecoveryFlow> response = apiInstance.GetRecoveryFlowWithHttpInfo(id, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.GetRecoveryFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`).
cookie string? 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. [optional]

Return type

KratosRecoveryFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 recoveryFlow -
404 errorGeneric -
410 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetRegistrationFlow

KratosRegistrationFlow GetRegistrationFlow (string id, string? cookie = null)

Get Registration Flow

This endpoint returns a registration flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: js pseudo-code example router.get('/registration', async function (req, res) { const flow = await client.getRegistrationFlow(req.header('cookie'), req.query['flow']) res.render('registration', flow) }) This request may fail due to several reasons. The error.id can be one of: session_already_available: The user is already signed in. self_service_flow_expired: The flow is expired and you should request a new one. More information can be found at Ory Kratos User Login and User Registration Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class GetRegistrationFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var id = "id_example";  // string | The Registration Flow ID  The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`).
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Get Registration Flow
                KratosRegistrationFlow result = apiInstance.GetRegistrationFlow(id, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.GetRegistrationFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetRegistrationFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get Registration Flow
    ApiResponse<KratosRegistrationFlow> response = apiInstance.GetRegistrationFlowWithHttpInfo(id, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.GetRegistrationFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string The Registration Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`).
cookie string? 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. [optional]

Return type

KratosRegistrationFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 registrationFlow -
403 errorGeneric -
404 errorGeneric -
410 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetSettingsFlow

KratosSettingsFlow GetSettingsFlow (string id, string? xSessionToken = null, string? cookie = null)

Get Settings Flow

When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are 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 or change the configuration. You can access this endpoint without credentials when using Ory Kratos' Admin API. 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 flow was interrupted with session_refresh_required but apparently some other identity logged in instead. More information can be found at Ory Kratos User Settings & Profile Management Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class GetSettingsFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var id = "id_example";  // string | ID is the Settings Flow ID  The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`).
            var xSessionToken = "xSessionToken_example";  // string? | The Session Token  When using the SDK in an app without a browser, please include the session token here. (optional) 
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Get Settings Flow
                KratosSettingsFlow result = apiInstance.GetSettingsFlow(id, xSessionToken, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.GetSettingsFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetSettingsFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get Settings Flow
    ApiResponse<KratosSettingsFlow> response = apiInstance.GetSettingsFlowWithHttpInfo(id, xSessionToken, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.GetSettingsFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string ID is the Settings Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`).
xSessionToken string? The Session Token When using the SDK in an app without a browser, please include the session token here. [optional]
cookie string? 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. [optional]

Return type

KratosSettingsFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 settingsFlow -
401 errorGeneric -
403 errorGeneric -
404 errorGeneric -
410 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetVerificationFlow

KratosVerificationFlow GetVerificationFlow (string id, string? cookie = null)

Get Verification Flow

This endpoint returns a verification flow's context with, for example, error details and other information. Browser flows expect the anti-CSRF cookie to be included in the request's HTTP Cookie Header. For AJAX requests you must ensure that cookies are included in the request or requests will fail. If you use the browser-flow for server-side apps, the services need to run on a common top-level-domain and you need to forward the incoming HTTP Cookie header to this endpoint: js pseudo-code example router.get('/recovery', async function (req, res) { const flow = await client.getVerificationFlow(req.header('cookie'), req.query['flow']) res.render('verification', flow) }) More information can be found at Ory Kratos Email and Phone Verification Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class GetVerificationFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var id = "id_example";  // string | The Flow ID  The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`).
            var cookie = "cookie_example";  // string? | HTTP Cookies  When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. (optional) 

            try
            {
                // Get Verification Flow
                KratosVerificationFlow result = apiInstance.GetVerificationFlow(id, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.GetVerificationFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetVerificationFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get Verification Flow
    ApiResponse<KratosVerificationFlow> response = apiInstance.GetVerificationFlowWithHttpInfo(id, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.GetVerificationFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string The Flow ID The value for this parameter comes from `request` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`).
cookie string? HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. [optional]

Return type

KratosVerificationFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 verificationFlow -
403 errorGeneric -
404 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetWebAuthnJavaScript

string GetWebAuthnJavaScript ()

Get WebAuthn JavaScript

This endpoint provides JavaScript which is needed in order to perform WebAuthn login and registration. If you are building a JavaScript Browser App (e.g. in ReactJS or AngularJS) you will need to load this file: html <script src=\"https://public-kratos.example.org/.well-known/ory/webauthn.js\" type=\"script\" async /> More information can be found at Ory Kratos User Login and User Registration Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class GetWebAuthnJavaScriptExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);

            try
            {
                // Get WebAuthn JavaScript
                string result = apiInstance.GetWebAuthnJavaScript();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.GetWebAuthnJavaScript: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetWebAuthnJavaScriptWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get WebAuthn JavaScript
    ApiResponse<string> response = apiInstance.GetWebAuthnJavaScriptWithHttpInfo();
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.GetWebAuthnJavaScriptWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

This endpoint does not need any parameter.

Return type

string

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 webAuthnJavaScript -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListMySessions

List<KratosSession> ListMySessions (long? perPage = null, long? page = null, long? pageSize = null, string? pageToken = null, string? xSessionToken = null, string? cookie = null)

Get My Active Sessions

This endpoints returns all other active sessions that belong to the logged-in user. The current session can be retrieved by calling the /sessions/whoami endpoint.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class ListMySessionsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var perPage = 250L;  // long? | Deprecated Items per Page  DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future.  This is the number of items per page. (optional)  (default to 250)
            var page = 789L;  // long? | Deprecated Pagination Page  DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future.  This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list.  For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. (optional) 
            var pageSize = 250L;  // long? | Page Size  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). (optional)  (default to 250)
            var pageToken = "\"1\"";  // string? | 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). (optional)  (default to "1")
            var xSessionToken = "xSessionToken_example";  // string? | Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. (optional) 
            var cookie = "cookie_example";  // string? | Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`.  It is ok if more than one cookie are included here as all other cookies will be ignored. (optional) 

            try
            {
                // Get My Active Sessions
                List<KratosSession> result = apiInstance.ListMySessions(perPage, page, pageSize, pageToken, xSessionToken, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.ListMySessions: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the ListMySessionsWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Get My Active Sessions
    ApiResponse<List<KratosSession>> response = apiInstance.ListMySessionsWithHttpInfo(perPage, page, pageSize, pageToken, xSessionToken, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.ListMySessionsWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
perPage long? Deprecated Items per Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This is the number of items per page. [optional] [default to 250]
page long? Deprecated Pagination Page DEPRECATED: Please use `page_token` instead. This parameter will be removed in the future. This value is currently an integer, but it is not sequential. The value is not the page number, but a reference. The next page can be any number and some numbers might return an empty list. For example, page 2 might not follow after page 1. And even if page 3 and 5 exist, but page 4 might not exist. The first page can be retrieved by omitting this parameter. Following page pointers will be returned in the `Link` header. [optional]
pageSize long? Page Size This is the number of items per page to return. For details on pagination please head over to the pagination documentation. [optional] [default to 250]
pageToken string? Next Page Token The next page token. For details on pagination please head over to the pagination documentation. [optional] [default to "1"]
xSessionToken string? Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. [optional]
cookie string? Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. [optional]

Return type

List<KratosSession>

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List My Session Response -
400 errorGeneric -
401 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PerformNativeLogout

void PerformNativeLogout (KratosPerformNativeLogoutBody kratosPerformNativeLogoutBody)

Perform Logout for Native Apps

Use this endpoint to log out an identity using an Ory Session Token. If the Ory Session Token was successfully revoked, the server returns a 204 No Content response. A 204 No Content response is also sent when the Ory Session Token has been revoked already before. If the Ory Session Token is malformed or does not exist a 403 Forbidden response will be returned. This endpoint does not remove any HTTP Cookies - use the Browser-Based Self-Service Logout Flow instead.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class PerformNativeLogoutExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var kratosPerformNativeLogoutBody = new KratosPerformNativeLogoutBody(); // KratosPerformNativeLogoutBody | 

            try
            {
                // Perform Logout for Native Apps
                apiInstance.PerformNativeLogout(kratosPerformNativeLogoutBody);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.PerformNativeLogout: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the PerformNativeLogoutWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Perform Logout for Native Apps
    apiInstance.PerformNativeLogoutWithHttpInfo(kratosPerformNativeLogoutBody);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.PerformNativeLogoutWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
kratosPerformNativeLogoutBody KratosPerformNativeLogoutBody

Return type

void (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ToSession

KratosSession ToSession (string? xSessionToken = null, string? cookie = null, string? tokenizeAs = null)

Check Who the Current HTTP Session Belongs To

Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. Returns a session object in the body or 401 if the credentials are invalid or no credentials were sent. When the request it successful it adds the user ID to the 'X-Kratos-Authenticated-Identity-Id' header in the response. If you call this endpoint from a server-side application, you must forward the HTTP Cookie Header to this endpoint: js pseudo-code example router.get('/protected-endpoint', async function (req, res) { const session = await client.toSession(undefined, req.header('cookie')) console.log(session) }) When calling this endpoint from a non-browser application (e.g. mobile app) you must include the session token: js pseudo-code example ... const session = await client.toSession(\"the-session-token\") console.log(session) When using a token template, the token is included in the tokenized field of the session. js pseudo-code example ... const session = await client.toSession(\"the-session-token\", { tokenize_as: \"example-jwt-template\" }) console.log(session.tokenized) // The JWT Depending on your configuration this endpoint might return a 403 status code 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 or change the configuration. This endpoint is useful for: AJAX calls. Remember to send credentials and set up CORS correctly! Reverse proxies and API Gateways Server-side calls - use the X-Session-Token header! This endpoint authenticates users by checking: if the Cookie HTTP header was set containing an Ory Kratos Session Cookie; if the Authorization: bearer <ory-session-token> HTTP header was set with a valid Ory Kratos Session Token; if the X-Session-Token HTTP header was set with a valid Ory Kratos Session Token. If none of these headers are set or the cookie or token are invalid, the endpoint returns a HTTP 401 status code. As explained above, this request may fail due to several reasons. The error.id can be one of: session_inactive: No active session was found in the request (e.g. no Ory Session Cookie / Ory Session Token). session_aal2_required: An active session was found but it does not fulfil the Authenticator Assurance Level, implying that the session must (e.g.) authenticate the second factor.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class ToSessionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var xSessionToken = MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj;  // string? | Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. (optional) 
            var cookie = ory_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==;  // string? | Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`.  It is ok if more than one cookie are included here as all other cookies will be ignored. (optional) 
            var tokenizeAs = "tokenizeAs_example";  // string? | Returns the session additionally as a token (such as a JWT)  The value of this parameter has to be a valid, configured Ory Session token template. For more information head over to [the documentation](http://ory.sh/docs/identities/session-to-jwt-cors). (optional) 

            try
            {
                // Check Who the Current HTTP Session Belongs To
                KratosSession result = apiInstance.ToSession(xSessionToken, cookie, tokenizeAs);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.ToSession: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the ToSessionWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Check Who the Current HTTP Session Belongs To
    ApiResponse<KratosSession> response = apiInstance.ToSessionWithHttpInfo(xSessionToken, cookie, tokenizeAs);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.ToSessionWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
xSessionToken string? Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. [optional]
cookie string? Set the Cookie Header. This is especially useful when calling this endpoint from a server-side application. In that scenario you must include the HTTP Cookie Header which originally was included in the request to your server. An example of a session in the HTTP Cookie Header is: `ory_kratos_session=a19iOVAbdzdgl70Rq1QZmrKmcjDtdsviCTZx7m9a9yHIUS8Wa9T7hvqyGTsLHi6Qifn2WUfpAKx9DWp0SJGleIn9vh2YF4A16id93kXFTgIgmwIOvbVAScyrx7yVl6bPZnCx27ec4WQDtaTewC1CpgudeDV2jQQnSaCP6ny3xa8qLH-QUgYqdQuoA_LF1phxgRCUfIrCLQOkolX5nv3ze_f==`. It is ok if more than one cookie are included here as all other cookies will be ignored. [optional]
tokenizeAs string? Returns the session additionally as a token (such as a JWT) The value of this parameter has to be a valid, configured Ory Session token template. For more information head over to the documentation. [optional]

Return type

KratosSession

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 session -
401 errorGeneric -
403 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateLoginFlow

KratosSuccessfulNativeLogin UpdateLoginFlow (string flow, KratosUpdateLoginFlowBody kratosUpdateLoginFlowBody, string? xSessionToken = null, string? cookie = null)

Submit a Login Flow

Use this endpoint to complete a login flow. This endpoint behaves differently for API and browser flows. API flows expect application/json to be sent in the body and responds with HTTP 200 and a application/json body with the session token on success; HTTP 410 if the original flow expired with the appropriate error messages set and optionally a use_flow_id parameter in the body; HTTP 400 on form validation errors. Browser flows expect a Content-Type of application/x-www-form-urlencoded or application/json to be sent in the body and respond with a HTTP 303 redirect to the post/after login URL or the return_to value if it was set and if the login succeeded; a HTTP 303 redirect to the login UI URL with the flow ID containing the validation errors otherwise. Browser flows with an accept header of application/json will not redirect but instead respond with HTTP 200 and a application/json body with the signed in identity and a Set-Cookie header on success; HTTP 303 redirect to a fresh login flow if the original flow expired with the appropriate error messages set; HTTP 400 on form validation errors. If this endpoint is called with Accept: application/json in the header, 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! browser_location_change_required: Usually sent when an AJAX request indicates that the browser needs to open a specific URL. Most likely used in Social Sign In flows. More information can be found at Ory Kratos User Login and User Registration Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class UpdateLoginFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var flow = "flow_example";  // string | The Login Flow ID  The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`).
            var kratosUpdateLoginFlowBody = new KratosUpdateLoginFlowBody(); // KratosUpdateLoginFlowBody | 
            var xSessionToken = "xSessionToken_example";  // string? | The Session Token of the Identity performing the settings flow. (optional) 
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Submit a Login Flow
                KratosSuccessfulNativeLogin result = apiInstance.UpdateLoginFlow(flow, kratosUpdateLoginFlowBody, xSessionToken, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.UpdateLoginFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UpdateLoginFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Submit a Login Flow
    ApiResponse<KratosSuccessfulNativeLogin> response = apiInstance.UpdateLoginFlowWithHttpInfo(flow, kratosUpdateLoginFlowBody, xSessionToken, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.UpdateLoginFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
flow string The Login Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/login?flow=abcde`).
kratosUpdateLoginFlowBody KratosUpdateLoginFlowBody
xSessionToken string? The Session Token of the Identity performing the settings flow. [optional]
cookie string? 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. [optional]

Return type

KratosSuccessfulNativeLogin

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successfulNativeLogin -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 loginFlow -
410 errorGeneric -
422 errorBrowserLocationChangeRequired -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateLogoutFlow

void UpdateLogoutFlow (string? token = null, string? returnTo = null, string? cookie = null)

Update Logout Flow

This endpoint logs out an identity in a self-service manner. If the Accept HTTP header is not set to application/json, the browser will be redirected (HTTP 303 See Other) to the return_to parameter of the initial request or fall back to urls.default_return_to. If the Accept HTTP header is set to application/json, a 204 No Content response will be sent on successful logout instead. 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. More information can be found at Ory Kratos User Logout Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class UpdateLogoutFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var token = "token_example";  // string? | A Valid Logout Token  If you do not have a logout token because you only have a session cookie, call `/self-service/logout/browser` to generate a URL for this endpoint. (optional) 
            var returnTo = "returnTo_example";  // string? | The URL to return to after the logout was completed. (optional) 
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Update Logout Flow
                apiInstance.UpdateLogoutFlow(token, returnTo, cookie);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.UpdateLogoutFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UpdateLogoutFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Update Logout Flow
    apiInstance.UpdateLogoutFlowWithHttpInfo(token, returnTo, cookie);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.UpdateLogoutFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
token string? A Valid Logout Token If you do not have a logout token because you only have a session cookie, call `/self-service/logout/browser` to generate a URL for this endpoint. [optional]
returnTo string? The URL to return to after the logout was completed. [optional]
cookie string? 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. [optional]

Return type

void (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateRecoveryFlow

KratosRecoveryFlow UpdateRecoveryFlow (string flow, KratosUpdateRecoveryFlowBody kratosUpdateRecoveryFlowBody, string? token = null, string? cookie = null)

Update Recovery Flow

Use this endpoint to update a recovery flow. This endpoint behaves differently for API and browser flows and has several states: choose_method expects flow (in the URL query) and email (in the body) to be sent and works with API- and Browser-initiated flows. For API clients and Browser clients with HTTP Header Accept: application/json it either returns a HTTP 200 OK when the form is valid and HTTP 400 OK when the form is invalid. and a HTTP 303 See Other redirect with a fresh recovery flow if the flow was otherwise invalid (e.g. expired). For Browser clients without HTTP Header Accept or with Accept: text/_* it returns a HTTP 303 See Other redirect to the Recovery UI URL with the Recovery Flow ID appended. sent_email is the success state after choose_method for the link method and allows the user to request another recovery email. It works for both API and Browser-initiated flows and returns the same responses as the flow in choose_method state. passed_challenge expects a token to be sent in the URL query and given the nature of the flow ("sending a recovery link") does not have any API capabilities. The server responds with a HTTP 303 See Other redirect either to the Settings UI URL (if the link was valid) and instructs the user to update their password, or a redirect to the Recover UI URL with a new Recovery Flow ID which contains an error message that the recovery link was invalid. More information can be found at Ory Kratos Account Recovery Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class UpdateRecoveryFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var flow = "flow_example";  // string | The Recovery Flow ID  The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`).
            var kratosUpdateRecoveryFlowBody = new KratosUpdateRecoveryFlowBody(); // KratosUpdateRecoveryFlowBody | 
            var token = "token_example";  // string? | Recovery Token  The recovery token which completes the recovery request. If the token is invalid (e.g. expired) an error will be shown to the end-user.  This parameter is usually set in a link and not used by any direct API call. (optional) 
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Update Recovery Flow
                KratosRecoveryFlow result = apiInstance.UpdateRecoveryFlow(flow, kratosUpdateRecoveryFlowBody, token, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.UpdateRecoveryFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UpdateRecoveryFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Update Recovery Flow
    ApiResponse<KratosRecoveryFlow> response = apiInstance.UpdateRecoveryFlowWithHttpInfo(flow, kratosUpdateRecoveryFlowBody, token, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.UpdateRecoveryFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
flow string The Recovery Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/recovery?flow=abcde`).
kratosUpdateRecoveryFlowBody KratosUpdateRecoveryFlowBody
token string? Recovery Token The recovery token which completes the recovery request. If the token is invalid (e.g. expired) an error will be shown to the end-user. This parameter is usually set in a link and not used by any direct API call. [optional]
cookie string? 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. [optional]

Return type

KratosRecoveryFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 recoveryFlow -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 recoveryFlow -
410 errorGeneric -
422 errorBrowserLocationChangeRequired -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateRegistrationFlow

KratosSuccessfulNativeRegistration UpdateRegistrationFlow (string flow, KratosUpdateRegistrationFlowBody kratosUpdateRegistrationFlowBody, string? cookie = null)

Update Registration Flow

Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint behaves differently for API and browser flows. API flows expect application/json to be sent in the body and respond with HTTP 200 and a application/json body with the created identity success - if the session hook is configured the session and session_token will also be included; HTTP 410 if the original flow expired with the appropriate error messages set and optionally a use_flow_id parameter in the body; HTTP 400 on form validation errors. Browser flows expect a Content-Type of application/x-www-form-urlencoded or application/json to be sent in the body and respond with a HTTP 303 redirect to the post/after registration URL or the return_to value if it was set and if the registration succeeded; a HTTP 303 redirect to the registration UI URL with the flow ID containing the validation errors otherwise. Browser flows with an accept header of application/json will not redirect but instead respond with HTTP 200 and a application/json body with the signed in identity and a Set-Cookie header on success; HTTP 303 redirect to a fresh login flow if the original flow expired with the appropriate error messages set; HTTP 400 on form validation errors. If this endpoint is called with Accept: application/json in the header, 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! browser_location_change_required: Usually sent when an AJAX request indicates that the browser needs to open a specific URL. Most likely used in Social Sign In flows. More information can be found at Ory Kratos User Login and User Registration Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class UpdateRegistrationFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var flow = "flow_example";  // string | The Registration Flow ID  The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`).
            var kratosUpdateRegistrationFlowBody = new KratosUpdateRegistrationFlowBody(); // KratosUpdateRegistrationFlowBody | 
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Update Registration Flow
                KratosSuccessfulNativeRegistration result = apiInstance.UpdateRegistrationFlow(flow, kratosUpdateRegistrationFlowBody, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.UpdateRegistrationFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UpdateRegistrationFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Update Registration Flow
    ApiResponse<KratosSuccessfulNativeRegistration> response = apiInstance.UpdateRegistrationFlowWithHttpInfo(flow, kratosUpdateRegistrationFlowBody, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.UpdateRegistrationFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
flow string The Registration Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/registration?flow=abcde`).
kratosUpdateRegistrationFlowBody KratosUpdateRegistrationFlowBody
cookie string? 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. [optional]

Return type

KratosSuccessfulNativeRegistration

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successfulNativeRegistration -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 registrationFlow -
410 errorGeneric -
422 errorBrowserLocationChangeRequired -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateSettingsFlow

KratosSettingsFlow UpdateSettingsFlow (string flow, KratosUpdateSettingsFlowBody kratosUpdateSettingsFlowBody, string? xSessionToken = null, string? cookie = null)

Complete Settings Flow

Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint behaves differently for API and browser flows. API-initiated flows expect application/json to be sent in the body and respond with HTTP 200 and an application/json body with the session token on success; HTTP 303 redirect to a fresh settings flow if the original flow expired with the appropriate error messages set; HTTP 400 on form validation errors. HTTP 401 when the endpoint is called without a valid session token. HTTP 403 when selfservice.flows.settings.privileged_session_max_age was reached or the session's AAL is too low. Implies that the user needs to re-authenticate. Browser flows without HTTP Header Accept or with Accept: text/_* respond with a HTTP 303 redirect to the post/after settings URL or the return_to value if it was set and if the flow succeeded; a HTTP 303 redirect to the Settings UI URL with the flow ID containing the validation errors otherwise. a HTTP 303 redirect to the login endpoint when selfservice.flows.settings.privileged_session_max_age was reached or the session's AAL is too low. Browser flows with HTTP Header Accept: application/json respond with HTTP 200 and a application/json body with the signed in identity and a Set-Cookie header on success; HTTP 303 redirect to a fresh login flow if the original flow expired with the appropriate error messages set; HTTP 401 when the endpoint is called without a valid session cookie. HTTP 403 when the page is accessed without a session cookie or the session's AAL is too low. HTTP 400 on form validation errors. 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 with a Accept: application/json HTTP header, 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_refresh_required: The identity requested to change something that needs a privileged session. Redirect the identity to the login init endpoint with query parameters ?refresh=true&return_to=<the-current-browser-url>, or initiate a refresh login flow otherwise. 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 flow was interrupted with session_refresh_required but apparently some other identity logged in instead. security_identity_mismatch: The requested ?return_to address is not allowed to be used. Adjust this in the configuration! browser_location_change_required: Usually sent when an AJAX request indicates that the browser needs to open a specific URL. Most likely used in Social Sign In flows. More information can be found at Ory Kratos User Settings & Profile Management Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class UpdateSettingsFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var flow = "flow_example";  // string | The Settings Flow ID  The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`).
            var kratosUpdateSettingsFlowBody = new KratosUpdateSettingsFlowBody(); // KratosUpdateSettingsFlowBody | 
            var xSessionToken = "xSessionToken_example";  // string? | The Session Token of the Identity performing the settings flow. (optional) 
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Complete Settings Flow
                KratosSettingsFlow result = apiInstance.UpdateSettingsFlow(flow, kratosUpdateSettingsFlowBody, xSessionToken, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.UpdateSettingsFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UpdateSettingsFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Complete Settings Flow
    ApiResponse<KratosSettingsFlow> response = apiInstance.UpdateSettingsFlowWithHttpInfo(flow, kratosUpdateSettingsFlowBody, xSessionToken, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.UpdateSettingsFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
flow string The Settings Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/settings?flow=abcde`).
kratosUpdateSettingsFlowBody KratosUpdateSettingsFlowBody
xSessionToken string? The Session Token of the Identity performing the settings flow. [optional]
cookie string? 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. [optional]

Return type

KratosSettingsFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 settingsFlow -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 settingsFlow -
401 errorGeneric -
403 errorGeneric -
410 errorGeneric -
422 errorBrowserLocationChangeRequired -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateVerificationFlow

KratosVerificationFlow UpdateVerificationFlow (string flow, KratosUpdateVerificationFlowBody kratosUpdateVerificationFlowBody, string? token = null, string? cookie = null)

Complete Verification Flow

Use this endpoint to complete a verification flow. This endpoint behaves differently for API and browser flows and has several states: choose_method expects flow (in the URL query) and email (in the body) to be sent and works with API- and Browser-initiated flows. For API clients and Browser clients with HTTP Header Accept: application/json it either returns a HTTP 200 OK when the form is valid and HTTP 400 OK when the form is invalid and a HTTP 303 See Other redirect with a fresh verification flow if the flow was otherwise invalid (e.g. expired). For Browser clients without HTTP Header Accept or with Accept: text/_* it returns a HTTP 303 See Other redirect to the Verification UI URL with the Verification Flow ID appended. sent_email is the success state after choose_method when using the link method and allows the user to request another verification email. It works for both API and Browser-initiated flows and returns the same responses as the flow in choose_method state. passed_challenge expects a token to be sent in the URL query and given the nature of the flow ("sending a verification link") does not have any API capabilities. The server responds with a HTTP 303 See Other redirect either to the Settings UI URL (if the link was valid) and instructs the user to update their password, or a redirect to the Verification UI URL with a new Verification Flow ID which contains an error message that the verification link was invalid. More information can be found at Ory Kratos Email and Phone Verification Documentation.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

namespace Example
{
    public class UpdateVerificationFlowExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            var apiInstance = new FrontendApi(config);
            var flow = "flow_example";  // string | The Verification Flow ID  The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`).
            var kratosUpdateVerificationFlowBody = new KratosUpdateVerificationFlowBody(); // KratosUpdateVerificationFlowBody | 
            var token = "token_example";  // string? | Verification Token  The verification token which completes the verification request. If the token is invalid (e.g. expired) an error will be shown to the end-user.  This parameter is usually set in a link and not used by any direct API call. (optional) 
            var cookie = "cookie_example";  // string? | 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. (optional) 

            try
            {
                // Complete Verification Flow
                KratosVerificationFlow result = apiInstance.UpdateVerificationFlow(flow, kratosUpdateVerificationFlowBody, token, cookie);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling FrontendApi.UpdateVerificationFlow: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UpdateVerificationFlowWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Complete Verification Flow
    ApiResponse<KratosVerificationFlow> response = apiInstance.UpdateVerificationFlowWithHttpInfo(flow, kratosUpdateVerificationFlowBody, token, cookie);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling FrontendApi.UpdateVerificationFlowWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
flow string The Verification Flow ID The value for this parameter comes from `flow` URL Query parameter sent to your application (e.g. `/verification?flow=abcde`).
kratosUpdateVerificationFlowBody KratosUpdateVerificationFlowBody
token string? Verification Token The verification token which completes the verification request. If the token is invalid (e.g. expired) an error will be shown to the end-user. This parameter is usually set in a link and not used by any direct API call. [optional]
cookie string? 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. [optional]

Return type

KratosVerificationFlow

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 verificationFlow -
303 Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is typically 201. -
400 verificationFlow -
410 errorGeneric -
0 errorGeneric -

[Back to top] [Back to API list] [Back to Model list] [Back to README]