Skip to content

Documentation / expo / useLinkWithOAuth

Function: useLinkWithOAuth()

useLinkWithOAuth(opts?): Object

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

Parameters

opts?: OAuthHookOptions

Returns

Object

link: (__namedParameters) => Promise<undefined | PrivyUser> = start

Launch a web browser to link an external OAuth account

Parameters

__namedParameters: StartOAuthFlowArgs

Returns

Promise<undefined | PrivyUser>

Example

ts
<Button onPress={() => link({ provider: 'google' })} />

state

state: OAuthFlowState

Example

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

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

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