Phil
BABetter Auth
•Created by Phil on 4/28/2025 in #help
How to link Generic OAuth to existing user
I have a question about Generic OAuth account linking. Say I have a user [email protected]. I set up a Generic OAuth plugin to authenticate to Nylas, which in turn sends the user through an OAuth authentication with their Google account. But say the user's Google account email is [email protected].
Currently when user completes the Nylas authentication, better-auth is creating a new user [email protected], then creating a Nylas account record linked to that new user. But I want the Nylas account record to be linked to the currently-logged-in user [email protected] and not create a new user when the emails are different.
I tried this in my auth.ts config but it didn't help:
3 replies
BABetter Auth
•Created by Phil on 12/28/2024 in #help
Possible to pass an additional OAuth parameter?
When using Generic OAuth, is it possible to pass an additional parameter to the app's authorization endpoint? In Asana's case, if you pass
display_ui=always
, the user will be shown the Asana authorization dialog even if they have previously authorized the app. I would like to include this parameter; is it possible?3 replies
BABetter Auth
•Created by Phil on 12/27/2024 in #help
Can't get user data mapped properly
I'm using Generic OAuth to authenticate to Asana. The authentication itself works fine. When I call the Asana endpoint for getUserInfo, it returns this structure:
This structure leads to a better-auth error that email can't be null. So I'm assuming that I need to populate the top-level better-auth
enail
field from the Asana email
field that's within its data
object.
I've tried a number of variations of custom getUserInfo
and mapProfileToUser
functions but I can't get anything to work to map the data
felds to their top-level equivalent fields. Can someone help me with what function(s) I need to make this happen? TIA!!9 replies