# ProofKit: better-auth
> Better Auth adapter for FileMaker authentication
Documentation for the @proofkit/better-auth package.
---
# Introduction
URL: https://proofkit.proof.sh/docs/better-auth
@proofkit/better-auth
import { Cards, Card } from "fumadocs-ui/components/card";
import { SquareArrowOutUpRight } from "lucide-react";
What is Better-Auth? [#what-is-better-auth]
From the [Better-Auth](https://better-auth.com) website:
> The most comprehensive authentication framework for TypeScript.
Better-Auth has a robust plugin ecosystem that gives you the ability to pick and choose which authentication methods you want to use, all within a system that let's you securely host your own authentication.
The `@proofkit/better-auth` package allows you to use FileMaker as the backend database for the better-auth library, including automated schema migrations to easily add any neccesary tables and fields to your FileMaker file.
How to quickly get started with Better-Auth and FileMaker.
Better-Auth Docs{" "}
>
}
href="https://better-auth.com/docs"
>
Learn more about the Better-Auth framework and how to use it in your app.
---
# Installation & Usage
URL: https://proofkit.proof.sh/docs/better-auth/installation
import { CliCommand } from "@/components/CliCommand";
import { PackageInstall } from "@/components/PackageInstall";
import { Callout } from "fumadocs-ui/components/callout";
Prerequisites [#prerequisites]
* Ensure OData is enabled on your FileMaker server.
* Ensure your credentials have the `fmodata` privilege enabled.
* If you are using OttoFMS 4.11+ and you want to use a Data API key instead of plain credentials, ensure OData is enabled for that key.
Step 1: Manual Setup [#step-1-manual-setup]
Follow the [Better-Auth installation guide](https://better-auth.com/docs/installation) to get started in your app, but come back here for special instructions for anything related to your Database Setup or schema migrations.
Database Setup [#database-setup]
Ensure you have the @proofkit/better-auth and @proofkit/fmodata packages installed in your app.
Configure your database connection in your `auth.ts` file. Be sure to set these value secrets in your environment variables. The credentials you use here need `fmodata` permissions enabled, and read/write access to the better-auth tables.
```ts title="auth.ts"
import { betterAuth } from "better-auth";
import { FMServerConnection } from "@proofkit/fmodata";
import { FileMakerAdapter } from "@proofkit/better-auth";
const connection = new FMServerConnection({
serverUrl: process.env.FM_SERVER_URL!,
auth: {
// option 1: username/password credentials
username: process.env.FM_USERNAME!,
password: process.env.FM_PASSWORD!,
// option 2: Data API key (OttoFMS 4.11+, OData enabled for the key)
// apiKey: process.env.OTTO_API_KEY!,
},
});
const db = connection.database(process.env.FM_DATABASE!);
export const auth = betterAuth({
database: FileMakerAdapter({ database: db }),
// ...rest of your config
});
```
Step 2: Create/Update Database Tables [#step-2-createupdate-database-tables]
Run the following command to create the necessary tables and fields in your FileMaker file. It will show you a confirmation before any changes are applied, so you can review them.
\[Full Access] credentials are required for the schema changes to be applied automatically, but you may want to use a more restricted account for the rest of better-auth usage. If your credentials that you entered earlier in the `auth.ts` file do not have the \[Full Access] permissions, you can override them in the CLI.
These changes affect database schema only. No layouts or relationships are created or modified during this process.
The tables/fields that are created will be dependent on how your `auth.ts` file is setup. If you want to use any of your existing tables, just set [custom table names](https://www.better-auth.com/docs/concepts/database#custom-table-names) in the `auth.ts` file before running the migration command.
You may see fields added to your tables that you don't plan on using, but it's best to keep them in your database anyway to avoid potential errors.
If you make any schema-related changes to the better-auth config, such as adding plugins, you will need to run the migration command again to apply the changes to your FileMaker file.
---
# Troubleshooting
URL: https://proofkit.proof.sh/docs/better-auth/troubleshooting
import { CliCommand } from "@/components/CliCommand";
Error when generating schema [#error-when-generating-schema]
```bash
ERROR [Better Auth]: filemaker is not supported. If it is a custom adapter, please request the maintainer to implement createSchema
```
This means you used the better-auth CLI directly instead of the @proofkit/better-auth version. Run this instead: