Skip to content

leancodepl/leancode_kratos

Folders and files

NameName
Last commit message
Last commit date
Jan 10, 2025
Mar 11, 2025
Mar 14, 2025
Nov 17, 2023
Feb 3, 2025
Jul 20, 2023
Mar 12, 2025
Jan 10, 2025
Mar 11, 2025
Jul 14, 2023
Jul 14, 2023
Jul 14, 2023
Mar 12, 2025

Repository files navigation

KratosClient

The KratosClient provides an API client for interacting with an Ory Kratos server.

Usage

To create a client

final client = KratosClient(
  baseUri: Uri.parse('https://kratos.example.com'), 
  browserCallback: (url) async {
    // open browser and return code
  },
);

Features

The main available APIs are

  • registerWithPassword - Register using email and password
  • registerWithOidc - Register using OpenID Connect provider
  • registerWithPasskey - Register using a passkey
  • loginWithPassword - Login with email and password
  • loginWithPasskey - Login with a passkey
  • getVerificationFlow - Get verification flow
  • verifyAccount - Complete email verification
  • getRecoveryFlow - Get account recovery flow
  • sendEmailRecoveryFlow - Initiate email account recovery
  • sendCodeRecoveryFlow - Submit recovery code
  • getUserProfile - Get user profile
  • updateTraits - Update user profile traits
  • updatePassword - Update user password
  • addPasskey - Add a new passkey
  • removePasskey - Remove a linked passkey
  • getPasskeys - Get all linked passkeys
  • logout - Logout user
  • refreshSessionToken - Refresh session token

Credentials Storage

The client handles persisting credentials like the session token. By default it uses FlutterSecureCredentialsStorage but you can pass a custom CredentialsStorage on construction.

Error Handling

Most methods return a union type for success or failure responses. See code for details on specific error types.

HTTP Client

The http.Client used to make requests can be customized by passing your own on construction.

Logging

Debug logging is printed using the logging package.