For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

Sign in a user

Use the useWeb3AuthConnect hook to sign a user in. Call connectTo with an AUTH_CONNECTION constant and any parameters the connection needs. connectTo resolves with the new connection, or with null if sign-in fails; read error for the reason.

Import​

import { useWeb3AuthConnect, AUTH_CONNECTION } from '@web3auth/react-native-sdk'

Usage​

import { useWeb3AuthConnect, AUTH_CONNECTION } from '@web3auth/react-native-sdk'

function LoginView() {
const { connectTo, loading, error } = useWeb3AuthConnect()

return (
<View>
<Button
title={loading ? 'Signing in…' : 'Sign in with Google'}
disabled={loading}
onPress={() => connectTo({ authConnection: AUTH_CONNECTION.GOOGLE })}
/>
<Button
title="Sign in with Apple"
disabled={loading}
onPress={() => connectTo({ authConnection: AUTH_CONNECTION.APPLE })}
/>
{error && <Text style={{ color: 'red' }}>{error.message}</Text>}
</View>
)
}

Parameters​

ParameterRequiredDescription
authConnectionYesAuthentication method. Pass an AUTH_CONNECTION.* constant.
authConnectionId?NoConnection ID from the dashboard. Required for AUTH_CONNECTION.CUSTOM and for grouped connections. Also use it to target a specific connection when you have several of the same type.
groupedAuthConnectionId?NoGrouped connection ID from the dashboard. Connections in the same group produce the same wallet for the same user.
idToken?NoJWT from your own auth provider. When set, the SDK skips the in-app browser and derives the wallet from the token directly. Requires authConnectionId. See Custom authentication.
extraLoginOptions?NoExtra OAuth parameters for browser-based sign-in, for example login_hint (email or phone number for passwordless), domain (Auth0 domain), and verifierIdField (JWT claim used as the user ID).
mfaLevel?NoWhen to show the MFA setup screen: 'optional', 'mandatory', or 'none' (MFA_LEVELS.OPTIONAL, MFA_LEVELS.MANDATORY, MFA_LEVELS.NONE).
curve?NoKey curve: SUPPORTED_KEY_CURVES.SECP256K1 or SUPPORTED_KEY_CURVES.ED25519.
dappShare?NoDapp share for MFA-enabled custom connections. The SDK stores and reuses the dapp share automatically; see Dapp share.
appState?NoCustom state string returned in userInfo.appState after sign-in.
dappUrl?NoCustom redirect URL for the manage MFA flow.