=begin #Ory APIs #Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. The version of the OpenAPI document: v1.14.5 Contact: support@ory.sh Generated by: https://openapi-generator.tech Generator version: 7.7.0 =end require 'cgi' module OryClient class FrontendApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param [Hash] opts the optional parameters # @option opts [Boolean] :refresh Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. # @option opts [String] :aal Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @option opts [String] :login_challenge 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`). # @option opts [String] :organization An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. # @option opts [String] :via Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. # @return [LoginFlow] def create_browser_login_flow(opts = {}) data, _status_code, _headers = create_browser_login_flow_with_http_info(opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param [Hash] opts the optional parameters # @option opts [Boolean] :refresh Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. # @option opts [String] :aal Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @option opts [String] :login_challenge 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`). # @option opts [String] :organization An optional organization ID that should be used for logging this user in. This parameter is only effective in the Ory Network. # @option opts [String] :via Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. # @return [Array<(LoginFlow, Integer, Hash)>] LoginFlow data, response status code and response headers def create_browser_login_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_browser_login_flow ...' end # resource path local_var_path = '/self-service/login/browser' # query parameters query_params = opts[:query_params] || {} query_params[:'refresh'] = opts[:'refresh'] if !opts[:'refresh'].nil? query_params[:'aal'] = opts[:'aal'] if !opts[:'aal'].nil? query_params[:'return_to'] = opts[:'return_to'] if !opts[:'return_to'].nil? query_params[:'login_challenge'] = opts[:'login_challenge'] if !opts[:'login_challenge'].nil? query_params[:'organization'] = opts[:'organization'] if !opts[:'organization'].nil? query_params[:'via'] = opts[:'via'] if !opts[:'via'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'LoginFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_browser_login_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_browser_login_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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. # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request. # @option opts [String] :return_to Return to URL The URL to which the browser should be redirected to after the logout has been performed. # @return [LogoutFlow] def create_browser_logout_flow(opts = {}) data, _status_code, _headers = create_browser_logout_flow_with_http_info(opts) data end # 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. # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies If you call this endpoint from a backend, please include the original Cookie header in the request. # @option opts [String] :return_to Return to URL The URL to which the browser should be redirected to after the logout has been performed. # @return [Array<(LogoutFlow, Integer, Hash)>] LogoutFlow data, response status code and response headers def create_browser_logout_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_browser_logout_flow ...' end # resource path local_var_path = '/self-service/logout/browser' # query parameters query_params = opts[:query_params] || {} query_params[:'return_to'] = opts[:'return_to'] if !opts[:'return_to'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'LogoutFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_browser_logout_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_browser_logout_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](../self-service/flows/account-recovery). # @param [Hash] opts the optional parameters # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @return [RecoveryFlow] def create_browser_recovery_flow(opts = {}) data, _status_code, _headers = create_browser_recovery_flow_with_http_info(opts) data end # 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](../self-service/flows/account-recovery). # @param [Hash] opts the optional parameters # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @return [Array<(RecoveryFlow, Integer, Hash)>] RecoveryFlow data, response status code and response headers def create_browser_recovery_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_browser_recovery_flow ...' end # resource path local_var_path = '/self-service/recovery/browser' # query parameters query_params = opts[:query_params] || {} query_params[:'return_to'] = opts[:'return_to'] if !opts[:'return_to'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RecoveryFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_browser_recovery_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_browser_recovery_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param [Hash] opts the optional parameters # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @option opts [String] :login_challenge 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. # @option opts [String] :after_verification_return_to 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. # @option opts [String] :organization # @return [RegistrationFlow] def create_browser_registration_flow(opts = {}) data, _status_code, _headers = create_browser_registration_flow_with_http_info(opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param [Hash] opts the optional parameters # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @option opts [String] :login_challenge 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. # @option opts [String] :after_verification_return_to 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. # @option opts [String] :organization # @return [Array<(RegistrationFlow, Integer, Hash)>] RegistrationFlow data, response status code and response headers def create_browser_registration_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_browser_registration_flow ...' end # resource path local_var_path = '/self-service/registration/browser' # query parameters query_params = opts[:query_params] || {} query_params[:'return_to'] = opts[:'return_to'] if !opts[:'return_to'].nil? query_params[:'login_challenge'] = opts[:'login_challenge'] if !opts[:'login_challenge'].nil? query_params[:'after_verification_return_to'] = opts[:'after_verification_return_to'] if !opts[:'after_verification_return_to'].nil? query_params[:'organization'] = opts[:'organization'] if !opts[:'organization'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RegistrationFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_browser_registration_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_browser_registration_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](../self-service/flows/user-settings). # @param [Hash] opts the optional parameters # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [SettingsFlow] def create_browser_settings_flow(opts = {}) data, _status_code, _headers = create_browser_settings_flow_with_http_info(opts) data end # 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](../self-service/flows/user-settings). # @param [Hash] opts the optional parameters # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [Array<(SettingsFlow, Integer, Hash)>] SettingsFlow data, response status code and response headers def create_browser_settings_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_browser_settings_flow ...' end # resource path local_var_path = '/self-service/settings/browser' # query parameters query_params = opts[:query_params] || {} query_params[:'return_to'] = opts[:'return_to'] if !opts[:'return_to'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SettingsFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_browser_settings_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_browser_settings_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). # @param [Hash] opts the optional parameters # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @return [VerificationFlow] def create_browser_verification_flow(opts = {}) data, _status_code, _headers = create_browser_verification_flow_with_http_info(opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). # @param [Hash] opts the optional parameters # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @return [Array<(VerificationFlow, Integer, Hash)>] VerificationFlow data, response status code and response headers def create_browser_verification_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_browser_verification_flow ...' end # resource path local_var_path = '/self-service/verification/browser' # query parameters query_params = opts[:query_params] || {} query_params[:'return_to'] = opts[:'return_to'] if !opts[:'return_to'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'VerificationFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_browser_verification_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_browser_verification_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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=`. You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks, including CSRF login attacks. In the case of an error, the `error.id` of the JSON response body can be one of: `session_already_available`: The user is already signed in. `session_aal1_required`: Multi-factor auth (e.g. 2fa) was requested but the user has no session yet. `security_csrf_violation`: Unable to fetch the flow because a CSRF violation occurred. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). More information can be found at [Ory Kratos User Login](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param [Hash] opts the optional parameters # @option opts [Boolean] :refresh Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. # @option opts [String] :aal Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". # @option opts [String] :x_session_token The Session Token of the Identity performing the settings flow. # @option opts [Boolean] :return_session_token_exchange_code 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. # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @option opts [String] :via Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. # @return [LoginFlow] def create_native_login_flow(opts = {}) data, _status_code, _headers = create_native_login_flow_with_http_info(opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param [Hash] opts the optional parameters # @option opts [Boolean] :refresh Refresh a login session If set to true, this will refresh an existing login session by asking the user to sign in again. This will reset the authenticated_at time of the session. # @option opts [String] :aal Request a Specific AuthenticationMethod Assurance Level Use this parameter to upgrade an existing session's authenticator assurance level (AAL). This allows you to ask for multi-factor authentication. When an identity sign in using e.g. username+password, the AAL is 1. If you wish to \"upgrade\" the session's security by asking the user to perform TOTP / WebAuth/ ... you would set this to \"aal2\". # @option opts [String] :x_session_token The Session Token of the Identity performing the settings flow. # @option opts [Boolean] :return_session_token_exchange_code 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. # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @option opts [String] :via Via should contain the identity's credential the code should be sent to. Only relevant in aal2 flows. # @return [Array<(LoginFlow, Integer, Hash)>] LoginFlow data, response status code and response headers def create_native_login_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_native_login_flow ...' end # resource path local_var_path = '/self-service/login/api' # query parameters query_params = opts[:query_params] || {} query_params[:'refresh'] = opts[:'refresh'] if !opts[:'refresh'].nil? query_params[:'aal'] = opts[:'aal'] if !opts[:'aal'].nil? query_params[:'return_session_token_exchange_code'] = opts[:'return_session_token_exchange_code'] if !opts[:'return_session_token_exchange_code'].nil? query_params[:'return_to'] = opts[:'return_to'] if !opts[:'return_to'].nil? query_params[:'via'] = opts[:'via'] if !opts[:'via'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'LoginFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_native_login_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_native_login_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](../self-service/flows/account-recovery). # @param [Hash] opts the optional parameters # @return [RecoveryFlow] def create_native_recovery_flow(opts = {}) data, _status_code, _headers = create_native_recovery_flow_with_http_info(opts) data end # 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](../self-service/flows/account-recovery). # @param [Hash] opts the optional parameters # @return [Array<(RecoveryFlow, Integer, Hash)>] RecoveryFlow data, response status code and response headers def create_native_recovery_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_native_recovery_flow ...' end # resource path local_var_path = '/self-service/recovery/api' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RecoveryFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_native_recovery_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_native_recovery_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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=`. 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param [Hash] opts the optional parameters # @option opts [Boolean] :return_session_token_exchange_code 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. # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @return [RegistrationFlow] def create_native_registration_flow(opts = {}) data, _status_code, _headers = create_native_registration_flow_with_http_info(opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param [Hash] opts the optional parameters # @option opts [Boolean] :return_session_token_exchange_code 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. # @option opts [String] :return_to The URL to return the browser to after the flow was completed. # @return [Array<(RegistrationFlow, Integer, Hash)>] RegistrationFlow data, response status code and response headers def create_native_registration_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_native_registration_flow ...' end # resource path local_var_path = '/self-service/registration/api' # query parameters query_params = opts[:query_params] || {} query_params[:'return_session_token_exchange_code'] = opts[:'return_session_token_exchange_code'] if !opts[:'return_session_token_exchange_code'].nil? query_params[:'return_to'] = opts[:'return_to'] if !opts[:'return_to'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RegistrationFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_native_registration_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_native_registration_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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=`. 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](../self-service/flows/user-settings). # @param [Hash] opts the optional parameters # @option opts [String] :x_session_token The Session Token of the Identity performing the settings flow. # @return [SettingsFlow] def create_native_settings_flow(opts = {}) data, _status_code, _headers = create_native_settings_flow_with_http_info(opts) data end # 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](../self-service/flows/user-settings). # @param [Hash] opts the optional parameters # @option opts [String] :x_session_token The Session Token of the Identity performing the settings flow. # @return [Array<(SettingsFlow, Integer, Hash)>] SettingsFlow data, response status code and response headers def create_native_settings_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_native_settings_flow ...' end # resource path local_var_path = '/self-service/settings/api' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SettingsFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_native_settings_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_native_settings_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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=`. 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](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). # @param [Hash] opts the optional parameters # @return [VerificationFlow] def create_native_verification_flow(opts = {}) data, _status_code, _headers = create_native_verification_flow_with_http_info(opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). # @param [Hash] opts the optional parameters # @return [Array<(VerificationFlow, Integer, Hash)>] VerificationFlow data, response status code and response headers def create_native_verification_flow_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.create_native_verification_flow ...' end # resource path local_var_path = '/self-service/verification/api' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'VerificationFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.create_native_verification_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#create_native_verification_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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. # @param [Hash] opts the optional parameters # @option opts [String] :x_session_token Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. # @option opts [String] :cookie 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. # @return [DeleteMySessionsCount] def disable_my_other_sessions(opts = {}) data, _status_code, _headers = disable_my_other_sessions_with_http_info(opts) data end # 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. # @param [Hash] opts the optional parameters # @option opts [String] :x_session_token Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. # @option opts [String] :cookie 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. # @return [Array<(DeleteMySessionsCount, Integer, Hash)>] DeleteMySessionsCount data, response status code and response headers def disable_my_other_sessions_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.disable_my_other_sessions ...' end # resource path local_var_path = '/sessions' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil? header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'DeleteMySessionsCount' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.disable_my_other_sessions", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#disable_my_other_sessions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Disable one of my sessions # Calling this endpoint invalidates the specified session. The current session cannot be revoked. Session data are not deleted. # @param id [String] ID is the session's ID. # @param [Hash] opts the optional parameters # @option opts [String] :x_session_token Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. # @option opts [String] :cookie 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. # @return [nil] def disable_my_session(id, opts = {}) disable_my_session_with_http_info(id, opts) nil end # Disable one of my sessions # Calling this endpoint invalidates the specified session. The current session cannot be revoked. Session data are not deleted. # @param id [String] ID is the session's ID. # @param [Hash] opts the optional parameters # @option opts [String] :x_session_token Set the Session Token when calling from non-browser clients. A session token has a format of `MP2YWEMeM8MxjkGKpH4dqOQ4Q4DlSPaj`. # @option opts [String] :cookie 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. # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def disable_my_session_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.disable_my_session ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FrontendApi.disable_my_session" end # resource path local_var_path = '/sessions/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil? header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.disable_my_session", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#disable_my_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Exchange Session Token # @param init_code [String] The part of the code return when initializing the flow. # @param return_to_code [String] The part of the code returned by the return_to URL. # @param [Hash] opts the optional parameters # @return [SuccessfulNativeLogin] def exchange_session_token(init_code, return_to_code, opts = {}) data, _status_code, _headers = exchange_session_token_with_http_info(init_code, return_to_code, opts) data end # Exchange Session Token # @param init_code [String] The part of the code return when initializing the flow. # @param return_to_code [String] The part of the code returned by the return_to URL. # @param [Hash] opts the optional parameters # @return [Array<(SuccessfulNativeLogin, Integer, Hash)>] SuccessfulNativeLogin data, response status code and response headers def exchange_session_token_with_http_info(init_code, return_to_code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.exchange_session_token ...' end # verify the required parameter 'init_code' is set if @api_client.config.client_side_validation && init_code.nil? fail ArgumentError, "Missing the required parameter 'init_code' when calling FrontendApi.exchange_session_token" end # verify the required parameter 'return_to_code' is set if @api_client.config.client_side_validation && return_to_code.nil? fail ArgumentError, "Missing the required parameter 'return_to_code' when calling FrontendApi.exchange_session_token" end # resource path local_var_path = '/sessions/token-exchange' # query parameters query_params = opts[:query_params] || {} query_params[:'init_code'] = init_code query_params[:'return_to_code'] = return_to_code # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SuccessfulNativeLogin' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.exchange_session_token", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#exchange_session_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors). # @param id [String] Error is the error's ID # @param [Hash] opts the optional parameters # @return [FlowError] def get_flow_error(id, opts = {}) data, _status_code, _headers = get_flow_error_with_http_info(id, opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors). # @param id [String] Error is the error's ID # @param [Hash] opts the optional parameters # @return [Array<(FlowError, Integer, Hash)>] FlowError data, response status code and response headers def get_flow_error_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.get_flow_error ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FrontendApi.get_flow_error" end # resource path local_var_path = '/self-service/errors' # query parameters query_params = opts[:query_params] || {} query_params[:'id'] = id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FlowError' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.get_flow_error", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#get_flow_error\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [LoginFlow] def get_login_flow(id, opts = {}) data, _status_code, _headers = get_login_flow_with_http_info(id, opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [Array<(LoginFlow, Integer, Hash)>] LoginFlow data, response status code and response headers def get_login_flow_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.get_login_flow ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FrontendApi.get_login_flow" end # resource path local_var_path = '/self-service/login/flows' # query parameters query_params = opts[:query_params] || {} query_params[:'id'] = id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'LoginFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.get_login_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#get_login_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](../self-service/flows/account-recovery). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [RecoveryFlow] def get_recovery_flow(id, opts = {}) data, _status_code, _headers = get_recovery_flow_with_http_info(id, opts) data end # 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](../self-service/flows/account-recovery). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [Array<(RecoveryFlow, Integer, Hash)>] RecoveryFlow data, response status code and response headers def get_recovery_flow_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.get_recovery_flow ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FrontendApi.get_recovery_flow" end # resource path local_var_path = '/self-service/recovery/flows' # query parameters query_params = opts[:query_params] || {} query_params[:'id'] = id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RecoveryFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.get_recovery_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#get_recovery_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [RegistrationFlow] def get_registration_flow(id, opts = {}) data, _status_code, _headers = get_registration_flow_with_http_info(id, opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/user-login) and [User Registration Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-registration). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [Array<(RegistrationFlow, Integer, Hash)>] RegistrationFlow data, response status code and response headers def get_registration_flow_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.get_registration_flow ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FrontendApi.get_registration_flow" end # resource path local_var_path = '/self-service/registration/flows' # query parameters query_params = opts[:query_params] || {} query_params[:'id'] = id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RegistrationFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.get_registration_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#get_registration_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](../self-service/flows/user-settings). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :x_session_token The Session Token When using the SDK in an app without a browser, please include the session token here. # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [SettingsFlow] def get_settings_flow(id, opts = {}) data, _status_code, _headers = get_settings_flow_with_http_info(id, opts) data end # 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](../self-service/flows/user-settings). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :x_session_token The Session Token When using the SDK in an app without a browser, please include the session token here. # @option opts [String] :cookie HTTP Cookies When using the SDK in a browser app, on the server side you must include the HTTP Cookie Header sent by the client to your server here. This ensures that CSRF and session cookies are respected. # @return [Array<(SettingsFlow, Integer, Hash)>] SettingsFlow data, response status code and response headers def get_settings_flow_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.get_settings_flow ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FrontendApi.get_settings_flow" end # resource path local_var_path = '/self-service/settings/flows' # query parameters query_params = opts[:query_params] || {} query_params[:'id'] = id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil? header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SettingsFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.get_settings_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#get_settings_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. # @return [VerificationFlow] def get_verification_flow(id, opts = {}) data, _status_code, _headers = get_verification_flow_with_http_info(id, opts) data end # 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](https://www.ory.sh/docs/kratos/self-service/flows/verify-email-account-activation). # @param 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`). # @param [Hash] opts the optional parameters # @option opts [String] :cookie HTTP Cookies When using the SDK on the server side you must include the HTTP Cookie Header originally sent to your HTTP handler here. # @return [Array<(VerificationFlow, Integer, Hash)>] VerificationFlow data, response status code and response headers def get_verification_flow_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FrontendApi.get_verification_flow ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling FrontendApi.get_verification_flow" end # resource path local_var_path = '/self-service/verification/flows' # query parameters query_params = opts[:query_params] || {} query_params[:'id'] = id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'VerificationFlow' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"FrontendApi.get_verification_flow", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FrontendApi#get_verification_flow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # 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