mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-16 04:35:24 +02:00
refactor(auth): update auth client to use new auth structure and improve type inference
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { betterAuthInstance } from "@dokploy/server";
|
||||
import type { auth } from "@dokploy/server";
|
||||
import {
|
||||
adminClient,
|
||||
apiKeyClient,
|
||||
@@ -15,6 +15,6 @@ export const authClient = createAuthClient({
|
||||
twoFactorClient(),
|
||||
apiKeyClient(),
|
||||
adminClient(),
|
||||
inferAdditionalFields<typeof betterAuthInstance>(),
|
||||
inferAdditionalFields<typeof auth.api>(),
|
||||
],
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ import { getHubSpotUTK, submitToHubSpot } from "../utils/tracking/hubspot";
|
||||
import { sendEmail } from "../verification/send-verification-email";
|
||||
import { getPublicIpWithFallback } from "../wss/utils";
|
||||
|
||||
export const betterAuthInstance = betterAuth({
|
||||
const { handler, api } = betterAuth({
|
||||
database: drizzleAdapter(db, {
|
||||
provider: "pg",
|
||||
schema: schema,
|
||||
@@ -272,12 +272,11 @@ export const betterAuthInstance = betterAuth({
|
||||
});
|
||||
|
||||
export const auth = {
|
||||
handler: betterAuthInstance.handler,
|
||||
createApiKey: betterAuthInstance.api.createApiKey,
|
||||
handler: handler,
|
||||
createApiKey: api.createApiKey,
|
||||
api: api,
|
||||
};
|
||||
|
||||
export const { handler, api } = betterAuthInstance;
|
||||
|
||||
export const validateRequest = async (request: IncomingMessage) => {
|
||||
const apiKey = request.headers["x-api-key"] as string;
|
||||
if (apiKey) {
|
||||
|
||||
Reference in New Issue
Block a user