Interface: NativeAuthRepository
Defined in: repositories/authRepository.native.ts:30
Chanomhub SDK - React Native Entry Point
This entry point provides React Native specific functionality that requires native dependencies like react-native-app-auth.
Example
Section titled “Example”import { createChanomhubClient } from '@chanomhub/sdk';import { createNativeAuthRepository } from '@chanomhub/sdk/native';
const sdk = createChanomhubClient();const nativeAuth = createNativeAuthRepository(sdk.rest, sdk.config);
// Sign in with Google on React Nativeconst result = await nativeAuth.signInWithGoogleNative({ googleClientId: 'your-google-client-id', redirectUri: 'com.yourapp:/oauth2redirect',});Methods
Section titled “Methods”exchangeOAuthToken()
Section titled “exchangeOAuthToken()”exchangeOAuthToken(oauthResult): Promise<LoginResponse | null>;Defined in: repositories/authRepository.native.ts:61
Exchange OAuth token from react-native-app-auth with backend. Use this if you handle the OAuth flow yourself.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
oauthResult | NativeOAuthResult | Result from react-native-app-auth authorize() |
Returns
Section titled “Returns”Promise<LoginResponse | null>
Login response with user and backend tokens
signInWithGoogleNative()
Section titled “signInWithGoogleNative()”signInWithGoogleNative(nativeConfig, options?): Promise<LoginResponse | null>;Defined in: repositories/authRepository.native.ts:37
Sign in with Google OAuth for React Native apps.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
nativeConfig | NativeOAuthConfig | Native OAuth configuration with client IDs and redirect URI |
options? | NativeOAuthOptions | Additional options like scopes |
Returns
Section titled “Returns”Promise<LoginResponse | null>
Login response with user and tokens from backend
signInWithProviderNative()
Section titled “signInWithProviderNative()”signInWithProviderNative( provider, nativeConfig,options?): Promise<LoginResponse | null>;Defined in: repositories/authRepository.native.ts:49
Sign in with any OAuth provider for React Native apps.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
provider | OAuthProvider | OAuth provider (google, discord, github) |
nativeConfig | NativeOAuthConfig | Native OAuth configuration |
options? | NativeOAuthOptions | Additional options |
Returns
Section titled “Returns”Promise<LoginResponse | null>
Login response with user and tokens from backend