The KratosClient provides an API client for interacting with an Ory Kratos server.
final client = KratosClient(
baseUri: Uri.parse('https://kratos.example.com'),
browserCallback: (url) async {
// open browser and return code
},
);
registerWithPassword
- Register using email and passwordregisterWithOidc
- Register using OpenID Connect provider
loginWithPassword
- Login with email and password
getVerificationFlow
- Get verification flowverifyAccount
- Complete email verification
getRecoveryFlow
- Get account recovery flowsendEmailRecoveryFlow
- Initiate email account recoverysendCodeRecoveryFlow
- Submit recovery code
getSettingsFlow
- Get user profileupdateTraits
- Update user profile traitsupdatePassword
- Update user password
logout
- Logout userrefreshSessionToken
- Refresh session token
The client handles persisting credentials like the session token. By default it uses FlutterSecureCredentialsStorage
but you can pass a custom CredentialsStorage
on construction.
Most methods return a union type for success or failure responses. See code for details on specific error types.
The http.Client
used to make requests can be customized by passing your own on construction.
Debug logging is printed using the logging
package.