Skip to content

Latest commit

 

History

History
312 lines (276 loc) · 21.7 KB

README.md

File metadata and controls

312 lines (276 loc) · 21.7 KB

Ory.Kratos.Client - the C# library for the Ory Identities API

This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more.

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: v1.2.1
  • SDK version: 1.2.1
  • Generator version: 7.7.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen For more information, please visit https://www.ory.sh

Frameworks supported

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Ory.Kratos.Client.Api;
using Ory.Kratos.Client.Client;
using Ory.Kratos.Client.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out Ory.Kratos.Client.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

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

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "http://localhost";
            // Configure API key authorization: oryAccessToken
            config.ApiKey.Add("Authorization", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("Authorization", "Bearer");

            var apiInstance = new CourierApi(config);
            var id = "id_example";  // string | MessageID is the ID of the message.

            try
            {
                // Get a Message
                KratosMessage result = apiInstance.GetCourierMessage(id);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling CourierApi.GetCourierMessage: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
CourierApi GetCourierMessage GET /admin/courier/messages/{id} Get a Message
CourierApi ListCourierMessages GET /admin/courier/messages List Messages
FrontendApi CreateBrowserLoginFlow GET /self-service/login/browser Create Login Flow for Browsers
FrontendApi CreateBrowserLogoutFlow GET /self-service/logout/browser Create a Logout URL for Browsers
FrontendApi CreateBrowserRecoveryFlow GET /self-service/recovery/browser Create Recovery Flow for Browsers
FrontendApi CreateBrowserRegistrationFlow GET /self-service/registration/browser Create Registration Flow for Browsers
FrontendApi CreateBrowserSettingsFlow GET /self-service/settings/browser Create Settings Flow for Browsers
FrontendApi CreateBrowserVerificationFlow GET /self-service/verification/browser Create Verification Flow for Browser Clients
FrontendApi CreateNativeLoginFlow GET /self-service/login/api Create Login Flow for Native Apps
FrontendApi CreateNativeRecoveryFlow GET /self-service/recovery/api Create Recovery Flow for Native Apps
FrontendApi CreateNativeRegistrationFlow GET /self-service/registration/api Create Registration Flow for Native Apps
FrontendApi CreateNativeSettingsFlow GET /self-service/settings/api Create Settings Flow for Native Apps
FrontendApi CreateNativeVerificationFlow GET /self-service/verification/api Create Verification Flow for Native Apps
FrontendApi DisableMyOtherSessions DELETE /sessions Disable my other sessions
FrontendApi DisableMySession DELETE /sessions/{id} Disable one of my sessions
FrontendApi ExchangeSessionToken GET /sessions/token-exchange Exchange Session Token
FrontendApi GetFlowError GET /self-service/errors Get User-Flow Errors
FrontendApi GetLoginFlow GET /self-service/login/flows Get Login Flow
FrontendApi GetRecoveryFlow GET /self-service/recovery/flows Get Recovery Flow
FrontendApi GetRegistrationFlow GET /self-service/registration/flows Get Registration Flow
FrontendApi GetSettingsFlow GET /self-service/settings/flows Get Settings Flow
FrontendApi GetVerificationFlow GET /self-service/verification/flows Get Verification Flow
FrontendApi GetWebAuthnJavaScript GET /.well-known/ory/webauthn.js Get WebAuthn JavaScript
FrontendApi ListMySessions GET /sessions Get My Active Sessions
FrontendApi PerformNativeLogout DELETE /self-service/logout/api Perform Logout for Native Apps
FrontendApi ToSession GET /sessions/whoami Check Who the Current HTTP Session Belongs To
FrontendApi UpdateLoginFlow POST /self-service/login Submit a Login Flow
FrontendApi UpdateLogoutFlow GET /self-service/logout Update Logout Flow
FrontendApi UpdateRecoveryFlow POST /self-service/recovery Update Recovery Flow
FrontendApi UpdateRegistrationFlow POST /self-service/registration Update Registration Flow
FrontendApi UpdateSettingsFlow POST /self-service/settings Complete Settings Flow
FrontendApi UpdateVerificationFlow POST /self-service/verification Complete Verification Flow
IdentityApi BatchPatchIdentities PATCH /admin/identities Create multiple identities
IdentityApi CreateIdentity POST /admin/identities Create an Identity
IdentityApi CreateRecoveryCodeForIdentity POST /admin/recovery/code Create a Recovery Code
IdentityApi CreateRecoveryLinkForIdentity POST /admin/recovery/link Create a Recovery Link
IdentityApi DeleteIdentity DELETE /admin/identities/{id} Delete an Identity
IdentityApi DeleteIdentityCredentials DELETE /admin/identities/{id}/credentials/{type} Delete a credential for a specific identity
IdentityApi DeleteIdentitySessions DELETE /admin/identities/{id}/sessions Delete & Invalidate an Identity's Sessions
IdentityApi DisableSession DELETE /admin/sessions/{id} Deactivate a Session
IdentityApi ExtendSession PATCH /admin/sessions/{id}/extend Extend a Session
IdentityApi GetIdentity GET /admin/identities/{id} Get an Identity
IdentityApi GetIdentitySchema GET /schemas/{id} Get Identity JSON Schema
IdentityApi GetSession GET /admin/sessions/{id} Get Session
IdentityApi ListIdentities GET /admin/identities List Identities
IdentityApi ListIdentitySchemas GET /schemas Get all Identity Schemas
IdentityApi ListIdentitySessions GET /admin/identities/{id}/sessions List an Identity's Sessions
IdentityApi ListSessions GET /admin/sessions List All Sessions
IdentityApi PatchIdentity PATCH /admin/identities/{id} Patch an Identity
IdentityApi UpdateIdentity PUT /admin/identities/{id} Update an Identity
MetadataApi GetVersion GET /version Return Running Software Version.
MetadataApi IsAlive GET /health/alive Check HTTP Server Status
MetadataApi IsReady GET /health/ready Check HTTP Server and Database Status

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

oryAccessToken

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header