KindeK
Kinde2y ago
19 replies
LIFE

error: getuser is not a function

I get the error:

Header.tsx:18 Uncaught (in promise) TypeError: getUser is not a function
    at getUsr (Header.tsx:18:22)
    at Header.tsx:22:3
    at commitHookEffectListMount (chunk-ZRJG7NCB.js?v=c5ae9bae:16904:34)
    at commitPassiveMountOnFiber (chunk-ZRJG7NCB.js?v=c5ae9bae:18152:19)
    at commitPassiveMountEffects_complete (chunk-ZRJG7NCB.js?v=c5ae9bae:18125:17)
    at commitPassiveMountEffects_begin (chunk-ZRJG7NCB.js?v=c5ae9bae:18115:15)
    at commitPassiveMountEffects (chunk-ZRJG7NCB.js?v=c5ae9bae:18105:11)
    at flushPassiveEffectsImpl (chunk-ZRJG7NCB.js?v=c5ae9bae:19486:11)
    at flushPassiveEffects (chunk-ZRJG7NCB.js?v=c5ae9bae:19443:22)
    at chunk-ZRJG7NCB.js?v=c5ae9bae:19324:17


i've tried two different approches:

    const { getUser, isLoading } =
        useKindeAuth();

    useEffect(() => {
        if (!isLoading) return;

        const getUsr = async () => {
            console.log("getting user");
            const usr = await getUser();
            return usr;
        };

        getUsr().then((user) => {
            console.log("name", user.given_name);
            console.log("name family", user.family_name);
        });
    }, [isLoading]);


const usr = await getUser();
console.log("name", usr.given_name);


I was unable to find a lot of documentation on this except for this https://kinde.com/docs/developer-tools/react-sdk/#api-references--usekindeauth-hook:~:text=.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c%3B-,getUser,-Link%20to%20this
Kinde Docs
Our developer tools provide everything you need to get started with Kinde.
React SDK - Developer tools - Help center
Was this page helpful?