Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject value missing in AdminModuleOptions.auth.authenticate #14

Open
OoDeLally opened this issue Mar 10, 2021 · 0 comments
Open

Reject value missing in AdminModuleOptions.auth.authenticate #14

OoDeLally opened this issue Mar 10, 2021 · 0 comments

Comments

@OoDeLally
Copy link

OoDeLally commented Mar 10, 2021

export interface AdminModuleOptions {
    adminBroOptions: AdminBroOptions;
    auth?: {
        authenticate: (email: string, password: string) => Promise<CurrentAdmin>; // here
        cookiePassword: string;
        cookieName: string;
    };
    formidableOptions?: ExpressFormidableOptions;
    sessionOptions?: SessionOptions;
}

There is no documented way to reject the authentication.

From a few issue discussions, I've seen empirically that return false is the way to reject the authentication.
Therefore the typing should be:

(email: string, password: string) => Promise<CurrentAdmin | false>

Throwing a JS error within the authenticate function would be preferable, but the promise rejection is not handled and crashes the server instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant