Skip to content

Documentation / expo / useLoginWithOAuth

Function: useLoginWithOAuth()

useLoginWithOAuth(opts?): UseLoginWithOAuth

Returns a login function to initiate an oauth login flow, as well as the current state of oauth flow

Parameters

opts?: OAuthHookOptions

Returns

UseLoginWithOAuth

Example

ts
// Somewhere within a component tree wrapped with <PrivyProvider />
const {login, state} = useLoginWithOAuth()

// Kick off an oauth flow
<Button onPress={() => login({ provider: 'google' })} /> *

// Show a spinner during the transition
{state.status === 'loading' && <Spinner />}