SDK Reference
react
getUserDetails

getUserDetails Method

This method is used to get the current user details from the Okto SDK. It will only return the user details if the user is authenticated.

Parameters

None

getUserDetails() => Promise<User>;

Example

import { useOkto, type OktoContextType, type User} from 'okto-sdk-react';
 
const { getUserDetails } = useOkto() as OktoContextType;
 
getUserDetails()
        .then((result) => {
        console.log(result)
        })
        .catch((error) => {
        console.error(`error:`, error);
        });