Authentication
Authentication components are exported from @ovok/native, but they execute against the OvokClient supplied by @ovok/core. Mount the app shell before rendering them.
Components
| Export | Purpose |
|---|---|
| SignIn | Composable sign-in screen with email and social-login building blocks |
| Register | Registration screen and form |
| ResetPassword | Password-reset screen and form |
| ProfileForm | Profile editing form |
| LogoutButton | Logs out through the active client |
| DeleteAccountButton | Requests account deletion through the active client |
The auth components use compound children. The full nested reference is under Authentication components, but root-level usage should always be checked against the current exported type definitions.
Email sign-in
import { SignIn } from "@ovok/native";
import { useRouter } from "expo-router";
export function LoginScreen() {
const router = useRouter();
return (
<SignIn>
<SignIn.Header>
<SignIn.Header.Title />
</SignIn.Header>
<SignIn.EmailForm
loginType="Patient"
tenantCode={process.env.EXPO_PUBLIC_TENANT_CODE}
onSuccess={() => router.replace("/")}
onError={(error) => console.error(error)}
>
<SignIn.EmailForm.Inputs />
<SignIn.EmailForm.SigninButton />
</SignIn.EmailForm>
</SignIn>
);
}
loginType and tenantCode are part of the form configuration. The onSuccess callback is the point at which the app should navigate or refresh patient state. Keep error handling in the host app so it can use the app's logging and message policy.
Social login
Install and configure the Google and Apple native plugins before rendering their buttons. Supply the client IDs and internal IDs required by the current @ovok/core backend configuration. Apple Sign-In is available on iOS only.
The example uses:
<SignIn.SocialLogins>
<SignIn.SocialLogins.GoogleLogin
googleIosClientId={googleIosClientId}
googleWebClientId={googleWebClientId}
internalId={googleInternalId}
onSuccess={onSuccess}
onError={onError}
>
<SignIn.SocialLogins.GoogleLogin.Icon />
<SignIn.SocialLogins.GoogleLogin.Text />
</SignIn.SocialLogins.GoogleLogin>
<SignIn.SocialLogins.AppleLogin
internalId={appleInternalId}
onSuccess={onSuccess}
onError={onError}
>
<SignIn.SocialLogins.AppleLogin.Icon />
<SignIn.SocialLogins.AppleLogin.Text />
</SignIn.SocialLogins.AppleLogin>
</SignIn.SocialLogins>
On cancellation or failure, keep the error callback visible during development. Malformed session state is an application-breaking condition; clear the active login and ask the user to retry rather than navigating as if the login succeeded.
Auth checklist
- OvokProvider is from @ovok/core, not @ovok/native.
- ThemeProvider is imported from @ovok/native, usually aliased locally.
- Google and Apple config plugins are present in the native build.
- Environment values are validated before the login screen renders.
- The app handles both success and error callbacks.
- A fresh dev client was rebuilt after adding or changing a native auth dependency.