K
Kindeβ€’12mo ago
Baloo

BrowserClient.getUser returns Promise<string>

Hi, I'm using kinde-typescript-sdk 2.3.2. It was really easy to integrate Kinde, registration and login are working, but when I call browserclient.getUser it seems to return a Promise<string> instead of Promise<UserType>. I kind of hacked around it but it's not pretty πŸ™‚ browserClient was created by createKindeBrowserClient()
No description
2 Replies
Oli - Kinde
Oli - Kindeβ€’12mo ago
Hey @Baloo, It seems like you're trying to get user details using the getUser method. However, in the Kinde TypeScript SDK, the method to get user details is getUserProfile(), not getUser(). See the following doc: https://kinde.com/docs/developer-tools/typescript-sdk/#view-user-profile Here's how you can use it:
const userProfile = await kindeClient.getUserProfile();
console.log(userProfile);
const userProfile = await kindeClient.getUserProfile();
console.log(userProfile);
This will return a Promise that resolves to an object with user details, like this:
{
"given_name": "Dave",
"id": "abcdef",
"family_name": "Smith",
"email": "[email protected]"
}
{
"given_name": "Dave",
"id": "abcdef",
"family_name": "Smith",
"email": "[email protected]"
}
I hope this helps! Let me know if you have any other questions. 😊
Kinde Docs
TypeScript SDK - Developer tools - Help center
Our developer tools provide everything you need to get started with Kinde.
Baloo
BalooOPβ€’12mo ago
Thanks! getUserProfile is working! May I suggest removing getUser from the type createKindeBrowserClient returns?
Want results from more Discord servers?
Add your server