# React Native SDK

`@ohauthcat/react-native` runs the sign-in logic (PKCE, state, nonce, callback and ID-token checks, refresh, revocation) in TypeScript and uses the native [iOS](/sdks/ios/) and [Android](/sdks/android/) SDKs for the system browser, secure storage, random bytes and passkeys. Tokens never go to AsyncStorage.

## Install

```sh
npm install @ohauthcat/react-native
cd ios && pod install
```

- Create the client with `new OhAuthCatClient({ loginOrigin, clientId, redirectUri }, nativePlatform(NativeModules.OhAuthCat, base64UrlDecode, fetch))`.
- Methods match the browser client: `signIn`, `signOut`, `getAccessToken`, `refresh`, `getUser`, `switchOrganization`, `isSignedIn` and `passkeys(backend)`.
- iOS: add the `OhAuthCatReactNative` pod. Android: the module autolinks; set `manifestPlaceholders["ohauthcatRedirectScheme"]`.

The bridge validates every value from JavaScript; native rejections map to `OhAuthCatError` with the catalogue code.
