react-native-okhi
    Preparing search index...

    Function login

    • Authenticates a user with the OkHi platform.

      Parameters

      • credentials: OkHiLogin

        The login configuration containing auth credentials and user info

      Returns Promise<string[] | null>

      A promise that resolves with an array of permission strings that were granted, or null if withPermissionsRequest was not enabled

      This must be called before any verification functions. It establishes the user session and validates your API credentials.

      The login persists for the duration of the app session. You should call this when your user signs in or when starting an address verification flow.

      import * as OkHi from 'react-native-okhi';
      import type { OkHiLogin } from 'react-native-okhi';

      const credentials: OkHiLogin = {
      auth: {
      branchId: 'your_branch_id',
      clientKey: 'your_client_key',
      },
      user: {
      firstName: 'John',
      lastName: 'Doe',
      phone: '+254712345678',
      email: 'john.doe@example.com',
      },
      };

      try {
      await OkHi.login(credentials);
      console.log('Login successful');
      } catch (error) {
      console.error('Login failed:', error);
      }