Kinde to Better-Auth

Hello, since the development of this library has impressed me a lot, I want to switch to it, but there is such a problem. In the integration I established with kinde auth before, user ids were kept as autoincrement int in my own database, how can I transfer the data here now?
61 Replies
Furkan Özay
Furkan ÖzayOP2mo ago
Does anybody have any idea? @bekacru can you help me ?
bekacru
bekacru2mo ago
Hey, I haven't looked into Kinde. Does it allow exporting user data?
user ids were kept as autoincrement
you can use numerical user id with Better Auth
Furkan Özay
Furkan ÖzayOP2mo ago
there is no need for this because the duplicate data is kept in my own database, I am only afraid of moving it together with the associated tables for the userId column I got an error when I tried this, it seemed like it was forcing it to be a string, but I will try again, thank you for the information Yes, it works smoothly, but it creates problems in some helper methods, for example, it gives impersonateUser type error and says bad request @bekacru
Furkan Özay
Furkan ÖzayOP2mo ago
No description
bekacru
bekacru2mo ago
try beta pnpm i better-auth@beta this issues should be fixed
Furkan Özay
Furkan ÖzayOP2mo ago
thank you, but I think the error persists because the impersonateUser method tries to convert to string
No description
Furkan Özay
Furkan ÖzayOP2mo ago
Also in credentials auth, accountId should have been a string, it warns that the integer came, the registration fails.
No description
Furkan Özay
Furkan ÖzayOP2mo ago
I think the best way would be to map the old data and adapt it to the string version, should I wait too long for this to be fixed for now, my customers need to receive updates. @bekacru I apologize for the mention, I'm just trying to find a solution
bekacru
bekacru2mo ago
oh I'll make this a priority. It'll be fixed! please ping me, if I incase forget.
Furkan Özay
Furkan ÖzayOP2mo ago
thank you very much, I wish there was something I could help you with, but I guess I don't have enough knowledge :/ Will the update come today or should we take a different action plan as a team? @bekacru
bekacru
bekacru2mo ago
Hey, probably not today. But will try to do it as soon as possible.
Furkan Özay
Furkan ÖzayOP2mo ago
Thank you for the information, I wish you ease @bekacru Is there hope nearby 😄
bekacru
bekacru2mo ago
thanks for the ping 😆 on it! Hey @Furkan Özay try pnpm i https://pkg.pr.new/better-auth/better-auth@1976 and let me know if it address your issue
Furkan Özay
Furkan ÖzayOP2mo ago
okay I'm trying
Furkan Özay
Furkan ÖzayOP2mo ago
@bekacru credentials registration
No description
Furkan Özay
Furkan ÖzayOP2mo ago
The accountId column expects a string value, but since accountId sends the user id when registering with email password, it goes as integer and an error occurs.
Furkan Özay
Furkan ÖzayOP2mo ago
and the following error during impersonateUser These are the two I've encountered so far
No description
bekacru
bekacru2mo ago
Furkan Özay
Furkan ÖzayOP2mo ago
I'm trying
Furkan Özay
Furkan ÖzayOP2mo ago
sorry still the same
No description
Furkan Özay
Furkan ÖzayOP2mo ago
@bekacru
bekacru
bekacru2mo ago
alright will get back to you later with a proper fix let me test it from my end
Furkan Özay
Furkan ÖzayOP2mo ago
Okay, I'll wait to hear from you.
Furkan Özay
Furkan ÖzayOP2mo ago
I think a field called userId was added here and the situation was the opposite 🙂
No description
Furkan Özay
Furkan ÖzayOP2mo ago
Do you want me to share the prisma schema? @bekacru
bekacru
bekacru2mo ago
no I wrote a test for a basic flow and it was passing. let me check. Hey, forgot to tell you, that you should enable advanced.useNumberId
Furkan Özay
Furkan ÖzayOP2mo ago
I'm trying
Furkan Özay
Furkan ÖzayOP2mo ago
Yes, the problem in the registration phase has been fixed, but impersonateUser still gives error
No description
Furkan Özay
Furkan ÖzayOP2mo ago
thanks for the fast support by the way @bekacru @bekacru Good morning, will this change come as a main version?
bekacru
bekacru2mo ago
Hey, @Ping is working on a more comprehnsive change for the adapters. And he'll include this change on his PR as well. I'll try to patch the impersonation so you can have a PR build until his PR gets merged.
Furkan Özay
Furkan ÖzayOP5w ago
@Ping any update ? Is there an improvement for impersonation? @bekacru
bekacru
bekacru5w ago
You should make impersonatedBy a string field. The issue is that impersonatedBy isn't marked as a reference field. Since it's optional, we didn't want to add a foreign key constraint, which prevents us from determining whether the field should be cast to a number or not.
Ping
Ping5w ago
Hey, I can give you the link to the PR for you to track. Basically most of the PR is done, just have to implement use number id and do testing for it. https://github.com/better-auth/better-auth/pull/1926
GitHub
add(adapter): createAdapter helper by ping-maxwell · Pull Reques...
What? The createAdapter function will handle everything a database adapter shouldn't be. The devs who create database adapters shouldn't have to worry about stuff like incorrect mod...
Furkan Özay
Furkan ÖzayOP5w ago
okey I'm trying yes it happens successfully but if I try with auth.api I get an unauthorized error, when I do it with authClient it works fine @bekacru
bekacru
bekacru5w ago
you ned to pass headers for auth.api
Furkan Özay
Furkan ÖzayOP5w ago
Oh, yeah, I'm so sorry. Thank you very much.
Ping
Ping5w ago
@Furkan Özay What database adapter are you using?
Furkan Özay
Furkan ÖzayOP5w ago
prisma @Ping Good morning, was it released in one of these major versions? @Ping
Ping
Ping5w ago
No it will still be a little away before release. You can track this PR to know if it's merged or not: https://github.com/better-auth/better-auth/pull/1926
GitHub
refactor: Adapter system + new id system by ping-maxwell · Pull...
What? The createAdapter function will handle everything a database adapter shouldn't be. The devs who create database adapters shouldn't have to worry about stuff like incorrect mod...
Furkan Özay
Furkan ÖzayOP3w ago
@Ping @bekacru any update ?
Ping
Ping3w ago
Hey the PR is done, it's just waiting for approval to then be merged. Currently Bekacru is busy, so it may take more time than usual.
Furkan Özay
Furkan ÖzayOP2w ago
thank you 🙏 I need to go out in production environment will it take much longer? @Ping @bekacru
bekacru
bekacru2w ago
Hey, I'm just a bit unsettled these days. Hpoefully, will be able to get it done this week ;))
Furkan Özay
Furkan ÖzayOP2w ago
When will it be reflected in one of the main releases, when it is apparently merge? @Ping @bekacru
No description
Furkan Özay
Furkan ÖzayOP2w ago
I apologize for the spelling mistakes, my English is a bit weak
Ping
Ping2w ago
Right now it's already out in beta, for 1.2.6-beta.8 https://github.com/better-auth/better-auth/releases/tag/v1.2.6-beta.8
GitHub
Release v1.2.6-beta.8 · better-auth/better-auth
🚀 Features createAdapter and useNumberId  -  by @ping-maxwell in #1926 (98661) Support user data mapping in id token social sign-in  -  by @Bekacru (a4267) Update hover style for light mode in ...
Furkan Özay
Furkan ÖzayOP2w ago
oh, thank you for the information 🙏 how can I install this version with npm @Ping
Furkan Özay
Furkan ÖzayOP2w ago
I realized that there was a change in the code and edited it this way but I still get an error
No description
Furkan Özay
Furkan ÖzayOP2w ago
No description
Ping
Ping2w ago
Did you install the right version? Also, what DB adapter are you using?
Furkan Özay
Furkan ÖzayOP2w ago
1.2.6-beta.11 Prisma Adapter
Ping
Ping2w ago
What function did you call for this to occur?
Furkan Özay
Furkan ÖzayOP2w ago
getSession @Ping auth.api.getSession GET /api/auth/get-session - 500 I can test other things if you want, user registration, login, etc.
Ping
Ping2w ago
@Furkan Özay I'll do some investigating on my end and get back to you.
Ping
Ping2w ago
Just ran a test with prisma while using where clause with a string id value and it works. We may need to do the investigating on your end.
No description
Ping
Ping2w ago
Can you give me more details about how the error occured, or any other potential info from the error? I couldn't find a getById function in our codebase.
Furkan Özay
Furkan ÖzayOP2w ago
the error is most likely caused by my custom session setting, I will examine it and give information
No description
Ping
Ping2w ago
Oh, it's very possible that you've written your own prisma code which is using our id values. For context, id is still string, even after enabling useNumberId. The difference is that when any Better-auth code calls the adapter, the adapter will automatically convert the string id back to a number so that your DB works. In this case, you're taking id from the user.id which is a string. You need to convert that to an int.
Furkan Özay
Furkan ÖzayOP2w ago
Yes, the problem was exactly due to my usage, when I set it with parseInt, everything was fixed, thank you very much, thank you very much. @Ping
Ping
Ping2w ago
🫡

Did you find this page helpful?