Beignet API reference
    Preparing search index...

    Type Alias BetterAuthServer<User, Session>

    Minimal type representing a Better Auth server instance. This is the interface we expect from the Better Auth library.

    Applications pass their configured Better Auth instance to createAuthBetterAuthProvider, which must have an api.getSession method.

    type BetterAuthServer<User = unknown, Session = unknown> = {
        api: {
            getSession(
                context: { headers: Headers },
            ): Promise<{ session: Session; user: User } | null>;
        };
    }

    Type Parameters

    • User = unknown
    • Session = unknown
    Index

    Properties

    Properties

    api: {
        getSession(
            context: { headers: Headers },
        ): Promise<{ session: Session; user: User } | null>;
    }

    Better Auth's session API. The exact shape depends on Better Auth's API version.

    Type Declaration

    • getSession: function
      • Get the current session from a request. Better Auth returns null if not authenticated, or a session object containing user and session data.

        Parameters

        • context: { headers: Headers }

        Returns Promise<{ session: Session; user: User } | null>