sszczep
sszczep
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
Awesome! Thanks
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
I can make a PR if you'd like.
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
It works the same way in NextJS SDK
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
I think it would be neat to have a uniform API for users jumping across similar SDKs. Either remove, or add getUser everywhere to avoid confussion like here. The decisision if of course up to you.
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
Even better, all the store items should be properly typed to avoid type casting.
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
@Dave - Kinde @LIFE it doesn't matter if you await the synchronous function. According to the docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await, if the non-thenable value is specified, an already-fulfilled Promise is constructed and used. So basically await operator wraps the returned data in Promise.resolve() and returns the data on next tick. getUser method was just never implemented in React SDK from what I can see. Its type definition was added in this commit: https://github.com/kinde-oss/kinde-auth-react/commit/c8d5abe8ba67fba6a011f91446ed2ff31cf2d7d5, however, it was never defined in context provider. Linked threads are mentioning the NextJS SDK, and yes, the getUser method is present there: https://github.com/kinde-oss/kinde-auth-nextjs/blob/059547d6b6eb88b808aab04c653a380ecdb30ab3/src/frontend/AuthProvider.jsx#L225 I strongly believe it has been overlooked. In that case, I would recommend adding the following code to KindeProvider.tsx file:
const getUser = useCallback(() => client!.getUser(), [client]);
const getUser = useCallback(() => client!.getUser(), [client]);
and adding it to contextValue:
return {
...,
getUserOrganizations,
getUser,
}
return {
...,
getUserOrganizations,
getUser,
}
I also took a look at getUser() implementation in createKindeClient.ts in kinde-auth-pkce-js SDK : https://github.com/kinde-oss/kinde-auth-pkce-js/blob/057eaa2677572cafe790df2e636104a6fbdbd077/src/createKindeClient.ts#L398. I believe it would be better if the return type was nullable. Something like:
const getUser = () => {
return store.getItem(storageMap.user) as KindeUser | undefined;
};
const getUser = () => {
return store.getItem(storageMap.user) as KindeUser | undefined;
};
Looking at the implementation and store usage here: https://github.com/kinde-oss/kinde-auth-pkce-js/blob/main/src/state/store.ts, items[storageMap.user] might return undefined in some cases (eg. user is not logged in yet).
Unfortunately the proposed change could be breaking.
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
Would be great if someone from Kinde team could chime in
20 replies
KKinde
Created by LIFE on 3/5/2024 in #💻┃support
error: getuser is not a function
I think there is an issue with docs and context typing. You can see getUser type defined here: https://github.com/kinde-oss/kinde-auth-react/blob/main/src/state/KindeContext.ts, however, it’s never set in the reducer: https://github.com/kinde-oss/kinde-auth-react/blob/main/src/state/reducer.ts. Just replace getUser method call with accessing user property: const { isLoading, user } = useKindeAuth(). You probably also want to write if (isLoading) return; (the condition should be inverted).
20 replies
KKinde
Created by itsfingerlickinggood on 3/1/2024 in #💻┃support
Any new competitions ?
future competitions are not based on skill
I just hope that not was a mistake 😉
12 replies
KKinde
Created by Kenny on 3/3/2024 in #💻┃support
redirect
As an url parameter, just like in your original message
5 replies
KKinde
Created by Kenny on 3/3/2024 in #💻┃support
redirect
@Kenny have you tried using post_login_redirect_url=<url>? I just skimmed through the code but should work.
5 replies
KKinde
Created by itsfingerlickinggood on 3/1/2024 in #💻┃support
Any new competitions ?
@Daniel_Kinde @Oli - Kinde can’t wait for what’s coming next! I personally would love to see something SDK related, eg. bringing Kinde to new, not yet supported platforms. The code itself should clearly show the competitors skill. It would also help expanding the current userbase and using Kinde in some new interesting projects! Just my suggestion, looking forward to any updates on that matter.
12 replies
KKinde
Created by C on 2/29/2024 in #💻┃support
We can't find your account
Just use register link, not the login
8 replies
KKinde
Created by Gaden on 2/19/2024 in #💻┃support
Speedrun Competition Clarification
Tried to get a better one but was just impossible with my network
179 replies
KKinde
Created by Gaden on 2/19/2024 in #💻┃support
Speedrun Competition Clarification
Posted 0.96 2hrs ago. Previous one was 1.23 I guess
179 replies
KKinde
Created by Gaden on 2/19/2024 in #💻┃support
Speedrun Competition Clarification
Anyway, that’s in the past now
179 replies
KKinde
Created by Gaden on 2/19/2024 in #💻┃support
Speedrun Competition Clarification
Exactly, it was my keyboard software. Also it shouldn’t matter whether you map keys or just change OS shortcuts
179 replies
KKinde
Created by Gaden on 2/19/2024 in #💻┃support
Speedrun Competition Clarification
haha, thanks. Technically it wasn’t violating any specified rules but I assumed it would happen
179 replies
KKinde
Created by Gaden on 2/19/2024 in #💻┃support
Speedrun Competition Clarification
Yeah, with key mappings
179 replies