Skip to content
View erickweil's full-sized avatar
  • Brazil

Highlights

  • Pro

Block or report erickweil

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
erickweil/README.md

Better Auth Credentials Plugin

npm version

Generic credentials authentication plugin for Better Auth

The plugin itself can be used to authenticate to anything, as are you that handle the logic that verify user input credentials in the callback, and just need to return user data that will be used to create/update the user in the database.

(Early version, experimental, the behaviour WILL CHANGE)

Features

  • Full control over the authentication process
  • Auto sign-up (optional) and management of Account linking and session creation
  • Similar in behaviour to the default email & password flow, but YOU handle the verification of the credentials and allow automatically sign-up
  • Route customization, you can choose the route path and the body parameters (using zod schema that doubles as validation and OpenAPI documentation)
  • Supports custom callbacks for sign-in and sign-up events

Examples (All are built using express + MongoDB):

  • examples/basic - Basic usage example with a fake user store, showcasing the credentials callback functionality and how to handle user data
  • examples/ldap-auth - Uses this plugin to perform LDAP authentication, showing how easy is to use it

Considerations:

  • You need to return a email field after the authentication, this is used to create/update the user in the database, and also to link the account with the session (email field should be unique).
  • It's not intended to use this to re-implement password login, but to be used when you need to integrate with an external system that uses credentials for authentication, like LDAP, or any other system that you can verify the credentials and get user data. If you try to mimic password login by hashing and storing the password, aditional database round-trips will be needed as this plugin will search the user again after you alread did (just use the email & password flow or username plugin don't do this).

Installation https://www.npmjs.com/package/better-auth-credentials-plugin

npm install better-auth-credentials-plugin

Pinned Loading

  1. portugolweb portugolweb Public

    Simples versão web, compatível com smartphones, para programar na linguagem do portugol studio.

    JavaScript 54 13

  2. weilplace weilplace Public

    JavaScript

  3. GodotTests GodotTests Public

    Experimentando com Godot

    C# 13 1

  4. better-auth-credentials-plugin better-auth-credentials-plugin Public

    LDAP authentication plugin for Better Auth

    TypeScript 38 5

  5. testedocker testedocker Public

    Testando a utilização do docker

    Shell

  6. textadventures textadventures Public

    Aventuras de Texto, desenvolvidos por alunos do curso ADS

    TypeScript 1