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
Does anybody have any idea?
@bekacru can you help me ?
Hey, I haven't looked into Kinde. Does it allow exporting user data?
user ids were kept as autoincrementyou can use numerical user id with Better Auth
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

try beta
pnpm i better-auth@beta
this issues should be fixedthank you, but I think the error persists because the impersonateUser method tries to convert to string

Also in credentials auth, accountId should have been a string, it warns that the integer came, the registration fails.

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
oh I'll make this a priority. It'll be fixed!
please ping me, if I incase forget.
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
Hey, probably not today. But will try to do it as soon as possible.
Thank you for the information, I wish you ease
@bekacru Is there hope nearby 😄
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 issueokay I'm trying
@bekacru credentials registration

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.
and the following error during impersonateUser
These are the two I've encountered so far

thanks! could you try
npm i https://pkg.pr.new/better-auth/better-auth@22d89a8
I'm trying
sorry still the same

@bekacru
alright will get back to you later with a proper fix
let me test it from my end
Okay, I'll wait to hear from you.
I think a field called userId was added here and the situation was the opposite 🙂

Do you want me to share the prisma schema?
@bekacru
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
I'm trying
Yes, the problem in the registration phase has been fixed, but impersonateUser still gives error

thanks for the fast support by the way
@bekacru
@bekacru Good morning, will this change come as a main version?
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.
@Ping any update ?
Is there an improvement for impersonation? @bekacru
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.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...
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
you ned to pass headers for
auth.api
Oh, yeah, I'm so sorry. Thank you very much.
@Furkan Özay What database adapter are you using?
prisma @Ping
Good morning, was it released in one of these major versions? @Ping
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...
@Ping @bekacru any update ?
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.
thank you 🙏
I need to go out in production environment will it take much longer? @Ping @bekacru
Hey, I'm just a bit unsettled these days. Hpoefully, will be able to get it done this week ;))
When will it be reflected in one of the main releases, when it is apparently merge?
@Ping @bekacru

I apologize for the spelling mistakes, my English is a bit weak
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 ...
oh, thank you for the information 🙏
how can I install this version with npm @Ping
I realized that there was a change in the code and edited it this way
but I still get an error


Did you install the right version?
Also, what DB adapter are you using?
1.2.6-beta.11
Prisma Adapter
What function did you call for this to occur?
getSession @Ping
auth.api.getSession
GET /api/auth/get-session - 500
I can test other things if you want, user registration, login, etc.
@Furkan Özay I'll do some investigating on my end and get back to you.
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.
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.the error is most likely caused by my custom session setting, I will examine it and give information

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.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
🫡