Using Generic OAuth plugin to link social

So I have a user account, and they'll already be signed in, however I want the ability to use Roblox OAuth provider to link their roblox account to the main user. right now the account linking seems to only support the default providers.
15 Replies
bekacru
bekacru3mo ago
what version of better auth are you on?
HotShot
HotShotOP3mo ago
1.0.15
bekacru
bekacru3mo ago
I'll take a look and will keep you posted. feel free to open a github issue as well
HotShot
HotShotOP3mo ago
sure, I’ll open one shortly. Appreciate it as always
D3vision
D3vision3mo ago
Holy shit I was about to ask the same question, @bekacru this would be killer cause I am trying out BA just because of the ability to link social accounts And I am running into the same issue I have everything set up but I simply get:
{"message":"[\n {\n \"received\": \"roblox\",\n \"code\": \"invalid_enum_value\",\n \"options\": [\n \"apple\",\n \"discord\",\n \"facebook\",\n \"github\",\n \"microsoft\",\n \"google\",\n \"spotify\",\n \"twitch\",\n \"twitter\",\n \"dropbox\",\n \"linkedin\",\n \"gitlab\",\n \"reddit\"\n ],\n \"path\": [\n \"provider\"\n ],\n \"message\": \"Invalid enum value. Expected 'apple' | 'discord' | 'facebook' | 'github' | 'microsoft' | 'google' | 'spotify' | 'twitch' | 'twitter' | 'dropbox' | 'linkedin' | 'gitlab' | 'reddit', received 'roblox'\"\n }\n]","details":[{"received":"roblox","code":"invalid_enum_value","options":["apple","discord","facebook","github","microsoft","google","spotify","twitch","twitter","dropbox","linkedin","gitlab","reddit"],"path":["provider"],"message":"Invalid enum value. Expected 'apple' | 'discord' | 'facebook' | 'github' | 'microsoft' | 'google' | 'spotify' | 'twitch' | 'twitter' | 'dropbox' | 'linkedin' | 'gitlab' | 'reddit', received 'roblox'"}],"code":"______RECEIVED_ROBLOX____CODE_INVALID_ENUM_VALUE____OPTIONS_______APPLE______DISCORD______FACEBOOK______GITHUB______MICROSOFT______GOOGLE______SPOTIFY______TWITCH______TWITTER______DROPBOX______LINKEDIN______GITLAB______REDDIT________PATH_______PROVIDER________MESSAGE_INVALID_ENUM_VALUE_EXPECTED_APPLE__DISCORD__FACEBOOK__GITHUB__MICROSOFT__GOOGLE__SPOTIFY__TWITCH__TWITTER__DROPBOX__LINKEDIN__GITLAB__REDDIT_RECEIVED_ROBLOX__"}
{"message":"[\n {\n \"received\": \"roblox\",\n \"code\": \"invalid_enum_value\",\n \"options\": [\n \"apple\",\n \"discord\",\n \"facebook\",\n \"github\",\n \"microsoft\",\n \"google\",\n \"spotify\",\n \"twitch\",\n \"twitter\",\n \"dropbox\",\n \"linkedin\",\n \"gitlab\",\n \"reddit\"\n ],\n \"path\": [\n \"provider\"\n ],\n \"message\": \"Invalid enum value. Expected 'apple' | 'discord' | 'facebook' | 'github' | 'microsoft' | 'google' | 'spotify' | 'twitch' | 'twitter' | 'dropbox' | 'linkedin' | 'gitlab' | 'reddit', received 'roblox'\"\n }\n]","details":[{"received":"roblox","code":"invalid_enum_value","options":["apple","discord","facebook","github","microsoft","google","spotify","twitch","twitter","dropbox","linkedin","gitlab","reddit"],"path":["provider"],"message":"Invalid enum value. Expected 'apple' | 'discord' | 'facebook' | 'github' | 'microsoft' | 'google' | 'spotify' | 'twitch' | 'twitter' | 'dropbox' | 'linkedin' | 'gitlab' | 'reddit', received 'roblox'"}],"code":"______RECEIVED_ROBLOX____CODE_INVALID_ENUM_VALUE____OPTIONS_______APPLE______DISCORD______FACEBOOK______GITHUB______MICROSOFT______GOOGLE______SPOTIFY______TWITCH______TWITTER______DROPBOX______LINKEDIN______GITLAB______REDDIT________PATH_______PROVIDER________MESSAGE_INVALID_ENUM_VALUE_EXPECTED_APPLE__DISCORD__FACEBOOK__GITHUB__MICROSOFT__GOOGLE__SPOTIFY__TWITCH__TWITTER__DROPBOX__LINKEDIN__GITLAB__REDDIT_RECEIVED_ROBLOX__"}
bekacru
bekacru3mo ago
robolox isn't supported
D3vision
D3vision3mo ago
I know, I am also using the custom Oauth plugin And getting the exact same issue as HotShot Also replied to the issue on github lol
bekacru
bekacru3mo ago
generic oauth account linking isn't supported yet. should be supported soon.
D3vision
D3vision3mo ago
Sweet👌
HotShot
HotShotOP3mo ago
cool to hear im not the only one with this request!
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
D3vision
D3vision3mo ago
I just looked into making a PR for Roblox support and it's a bit more difficult than just adding the provider. Roblox does not provide an email address through their oauth which triggers some errors That is an issue that would need to be handled for either direct Roblox implementation or for custom oauth implementation for the account linking feature For anyone who's interested, my fork has the Roblox provider built-in and is currently on version 1.1.4. You can install it using npm install 'https://gitpkg.vercel.app/D3visionNL/better-auth/packages/better-auth?main' (or whichever package manager you prefer) I had to use gitpkg cause else you get the main package which is kinda useless since we only need the better-auth package. Config is:
roblox:{
clientId: <your clientid>,
clientSecret: <your clientsecret>,
}
roblox:{
clientId: <your clientid>,
clientSecret: <your clientsecret>,
}
Please do keep in mind that I am fully intending for this to be temporary so don't expect me to keep it up to date. And finally, I am not making a PR with my "implementation" due to the fact that Better Auth is hardcoded to expect an email address and Roblox does not provide email addresses. While my current fix works, this issue really needs a more proper fix that could also apply to other social providers. If something like this is not allowed to be shared here, please do let me know and I will remove the message
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
D3vision
D3vision3mo ago
Not a bad idea, however that would still leave the email checking problem. When using the manual linking feature, once the email existence check has passed it checks to see if the email for the user is the same as the email for the account you're trying to link. I really don't understand why cause this is a manual link so emails shouldn't matter but it does. So in your case it would still give you an error due to the username not being the same as the email address of the user @imide
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?