Function: createFdmAuth()
createFdmAuth(
fdm
,google?
,microsoft?
):any
Defined in: fdm-core/src/authentication.ts:22
Initializes and configures the authentication system for the farm management application.
This function sets up the better-auth system with a PostgreSQL database adapter and a custom schema. It validates that required environment variables for Google and Microsoft authentication are set, configures additional user fields (firstname, surname, lang, farm_active), and manages session parameters with a 30-day expiration and daily update. It also defines mappings from social provider profiles to user formats.
Parameters
fdm
any
The FDM instance providing the connection to the database. The instance can be created with createFdmServer.
google?
clientId
string
clientSecret
string
microsoft?
clientId
string
clientSecret
string
Returns
any
The configured authentication instance.
Throws
If required environment variables are missing or if role assignment fails.