useCreateKernelClientSocial
Hook for creating a kernel client with social login integration
Import
import { useCreateKernelClientSocial } from '@zerodev/waas'
Usage
import { useCreateKernelClientSocial } from '@zerodev/waas';
function App() {
const { login, isPending } = useCreateKernelClientSocial({
version: 'v3',
oauthCallbackUrl: window.location.href // Optional: Specify oauthCallbackUrl, defaults to the current window location
});
return (
<>
<button onClick={() => {
login('google');
}}>
Google Login
</button>
<p>{isPending ? 'Loading...' : ''}</p>
</>
);
}
Parameters
import { type UseCreateKernelClientSocialParameters } from '@zerodev/waas';
version
v2 | v3
The version of kernel account.
import { useCreateKernelClientSocial } from '@zerodev/waas';
function App() {
const { login, isPending } =
useCreateKernelClientSocial({ version: 'v3' });
}
oauthCallbackUrl (optional)
string
The callback URL for social login. After a successful login, the user will be redirected to this URL. Defaults to the current URI of your application if not specified.
Return Types
import { type UseCreateKernelClientSocialReturnType } from '@zerodev/waas'
login
(socialProvider: string) => void
The function to trigger the redirect to your social provider for login.
-
socialProvider
"google" | "facebook"
Specifies the social provider platform for login.
data
CreateKernelClientSocialReturnType | undefined
-
validator
KernelValidator<EntryPoint>
The object of kernel validator. -
kernelAccount
KernelSmartAccount<EntryPoint>
The object of kernel account. -
entryPoint
EntryPoint
The entrypoint address of kernel account.
error
Error | null
The error object for the mutation, if an error was encountered.
isError / isIdle / isPending / isSuccess
boolean
Boolean variables derived from status
.
isPaused
boolean
- will be
true
if the mutation has beenpaused
. - see Network Mode for more information.
status
'idle' | 'pending' | 'error' | 'success'
'idle'
initial status prior to the mutation function executing.'pending'
if the mutation is currently executing.'error'
if the last mutation attempt resulted in an error.'success'
if the last mutation attempt was successful.
reset
() => void
A function to clean the mutation internal state (e.g. it resets the mutation to its initial state).