Auth resource
Generated reference for ovok_sdk: auth resource.
- Stable unknown
- Release candidate since 0.1.0-rc.4
- Development since 0.1.0-dev.23+d339d81
AuthResource
class AuthResourceSign-in, registration, passwords and the account; sign-in runs anonymously.
Reached through ovok.auth. Every request throws an OvokException
subclass when it fails.
Constructors
AuthResource.new
AuthResource(
HttpClient _http,
String _tenantCode,
UserSession _session,
String? _clientId,
)clientId is the ClientApplication social sign-in and password resets go through.
| Parameter | Type | Kind | Default |
|---|---|---|---|
_http | HttpClient | positional | |
_tenantCode | String | positional | |
_session | UserSession | positional | |
_clientId | String? | positional |
Properties
AuthResource.sessions
final AuthSessionsResource sessionsThe account's sessions on the server.
Methods
AuthResource.login
Future<LoginResult> login({
required ProfileType profileType,
required String email,
required String password,
})Runs the tenant login with PKCE for the configured tenant.
Calls POST auth/tenant/{profileType}/login/start, then the token step.
Returns SignedIn, or MfaRequired when the account needs a second factor.
| Parameter | Type | Kind | Default |
|---|---|---|---|
profileType | ProfileType | required named | |
email | String | required named | |
password | String | required named |
Returns Future<LoginResult>.
AuthResource.verifyMfa
Future<LoginResult> verifyMfa(MfaChallenge challenge, String code)Completes a login that returned MfaRequired with the user's MFA code.
Calls POST auth/tenant/{profileType}/login/mfa, then the token step.
| Parameter | Type | Kind | Default |
|---|---|---|---|
challenge | MfaChallenge | positional | |
code | String | positional |
Returns Future<LoginResult>.
AuthResource.register
Future<RegisterResult> register(Registration registration, {String? continueAsPatientToken})Registers a patient account and signs it in.
Calls POST auth/tenant/Patient/register. Returns SignedIn, or
ClinicianInvite when the project routes the email to a clinician
invitation, which signs no one in. Throws OvokValidationException when
the password and its confirmation differ.
| Parameter | Type | Kind | Default |
|---|---|---|---|
registration | Registration | positional | |
continueAsPatientToken | String? | named |
Returns Future<RegisterResult>.
AuthResource.registerPractitioner
Future<Session> registerPractitioner(Registration registration)Registers a practitioner account and signs it in.
Calls POST auth/tenant/Practitioner/register. Throws
OvokValidationException when the password and its confirmation differ.
| Parameter | Type | Kind | Default |
|---|---|---|---|
registration | Registration | positional |
Returns Future<Session>.
AuthResource.socialLogin
Future<Session> socialLogin(
SocialProvider provider, {
required String internalId,
required Map<String, dynamic> credential,
})Signs in with an Apple or Google credential.
Calls POST auth/external/{provider}. credential is the provider's
sign-in result, sent as it is. Throws OvokConfigException when the
client was built without clientId.
| Parameter | Type | Kind | Default |
|---|---|---|---|
provider | SocialProvider | positional | |
internalId | String | required named | |
credential | Map<String, dynamic> | required named |
Returns Future<Session>.
AuthResource.current
Future<Session?> current()The stored session, or null when no one is signed in.
Returns Future<Session?>.
AuthResource.me
Future<Map<String, dynamic>> me()Fetches the signed-in account. Calls GET auth/me.
Returns Future<Map<String, dynamic>>.
AuthResource.changePassword
Future<Map<String, dynamic>> changePassword({required String oldPassword, required String newPassword})Changes the signed-in user's password. Calls PATCH v2/auth/change-password.
The confirmation is the app's to check; Ovok Core never receives it.
| Parameter | Type | Kind | Default |
|---|---|---|---|
oldPassword | String | required named | |
newPassword | String | required named |
Returns Future<Map<String, dynamic>>.
AuthResource.resetPassword
Future<Map<String, dynamic>> resetPassword({
required String email,
required ProfileType type,
String? clientId,
})Starts a password reset for email. Calls POST v2/auth/reset-password.
clientId overrides the client's configured clientId.
| Parameter | Type | Kind | Default |
|---|---|---|---|
email | String | required named | |
type | ProfileType | required named | |
clientId | String? | named |
Returns Future<Map<String, dynamic>>.
AuthResource.completePasswordReset
Future<Map<String, dynamic>> completePasswordReset({
required String id,
required String secret,
required String password,
})Sets password with the id and secret from the reset email.
Calls POST v2/auth/reset-password/process.
| Parameter | Type | Kind | Default |
|---|---|---|---|
id | String | required named | |
secret | String | required named | |
password | String | required named |
Returns Future<Map<String, dynamic>>.
AuthResource.deleteAccount
Future<Map<String, dynamic>> deleteAccount({required int days, bool wipe = false})Schedules the deletion in days; wipe also deletes the medical data then.
Calls DELETE auth/delete.
| Parameter | Type | Kind | Default |
|---|---|---|---|
days | int | required named | |
wipe | bool | named | false |
Returns Future<Map<String, dynamic>>.
AuthResource.logout
Future<void> logout()Ends the session on the server, and always locally, even when the server cannot be reached.
Calls DELETE auth/session/current.
Returns Future<void>.
SocialProvider
enum SocialProviderAn identity provider for AuthResource.socialLogin.
Values
SocialProvider.apple
static const SocialProvider appleSign in with Apple.
SocialProvider.google
static const SocialProvider googleSign in with Google.
Last updated on