0.88.0 • Published 3 months ago

authhero v0.88.0

Weekly downloads
-
License
-
Repository
-
Last release
3 months ago

Authhero

Authhero is an open-source authentication library designed as a drop-in replacement for Auth0. It provides a fully functional auth server that you can set up in minutes.

Getting Started

Set up a new project with Authhero in 5 minutes or less:

npx create authhero

Alternatively, you can install the npm packages into an existing project and integrate Authhero with your existing setup.

Installation

Authhero consists of several npm packages that provide different authentication-related functionalities. The package includes four Hono routers, each handling a different aspect of the auth server:

  • Management API (management-api): Exposes endpoints for managing authentication data, compatible with Auth0's /api/v2.
  • Auth API (auth-api): Implements OAuth2/OIDC endpoints for user authentication.
  • Universal Auth (universal-auth): Provides a server-side rendered UI for login.
  • SAML App (saml-app): Handles SAML authentication endpoints.

Creating a New Auth Server

To initialize an auth server using Authhero:

const { managementApp, oauthApp, universalApp, samlApp } = init({
  dataAdapter: params.dataAdapter,
});

rootApp
  .route("/", oauthApp)
  .route("/u", universalApp)
  .route("/api/v2", managementApp)
  .route("/", samlApp);

Data Adapters

Authhero uses data adapters to handle persistence. The default adapter is @authhero/kysely, which connects to any SQL database using Kysely. Future versions will migrate to Drizzle as the default data adapter. You can also create custom adapters, such as DynamoDB + Elasticsearch.

Hooks

Authhero supports hooks to customize authentication logic. For example, you can grant roles dynamically using the onExecuteCredentialsExchange hook:

hooks: {
  onExecuteCredentialsExchange: async (
    event: OnExecuteCredentialsExchangeEvent,
    api: OnExecuteCredentialsExchangeAPI,
  ) => {
    if (event.client.id === "sampleClient") {
      api.accessToken.setCustomClaim("roles", "admin");
    }
  }
},

Supported Hooks

  • onExecuteCredentialsExchange
  • onExecutePreUserRegistration
  • onExecutePostUserRegistration

Email Providers

Authhero supports email providers for sending authentication-related emails. You can use pre-built email provider packages or configure a custom provider. Example:

emailProviders: {
  sqs: sendSqsEmail,
},

Contributing

Contributions are welcome! Feel free to open issues and submit pull requests to improve Authhero.

License

Authhero is open-source and available under the MIT License.

0.85.0

3 months ago

0.86.0

3 months ago

0.82.0

3 months ago

0.87.0

3 months ago

0.83.0

3 months ago

0.88.0

3 months ago

0.84.0

3 months ago

0.81.0

4 months ago

0.78.0

4 months ago

0.74.2

4 months ago

0.74.1

4 months ago

0.79.0

4 months ago

0.75.0

4 months ago

0.76.0

4 months ago

0.80.0

4 months ago

0.77.0

4 months ago

0.74.0

4 months ago

0.70.0

4 months ago

0.67.0

4 months ago

0.71.0

4 months ago

0.68.0

4 months ago

0.72.0

4 months ago

0.69.0

4 months ago

0.73.0

4 months ago

0.66.0

4 months ago

0.64.0

4 months ago

0.65.0

4 months ago

0.62.0

4 months ago

0.59.0

4 months ago

0.55.0

4 months ago

0.55.1

4 months ago

0.63.0

4 months ago

0.56.0

4 months ago

0.60.0

4 months ago

0.57.0

4 months ago

0.61.0

4 months ago

0.54.0

4 months ago

0.51.0

5 months ago

0.52.0

5 months ago

0.49.1

5 months ago

0.53.0

5 months ago

0.48.0

5 months ago

0.46.0

5 months ago

0.44.0

5 months ago

0.49.0

5 months ago

0.47.0

5 months ago

0.45.0

5 months ago

0.43.0

5 months ago

0.41.0

5 months ago

0.38.0

5 months ago

0.42.0

5 months ago

0.40.0

5 months ago

0.39.0

5 months ago

0.36.2

6 months ago

0.36.1

6 months ago

0.36.0

6 months ago

0.34.0

6 months ago

0.32.1

6 months ago

0.35.0

6 months ago

0.33.0

6 months ago

0.32.0

6 months ago

0.30.0

6 months ago

0.29.0

6 months ago

0.31.0

6 months ago

0.27.0

6 months ago

0.28.0

6 months ago

0.26.0

6 months ago

0.25.2

6 months ago

0.25.1

6 months ago

0.25.0

6 months ago

0.23.0

6 months ago

0.21.0

6 months ago

0.24.0

6 months ago

0.22.0

6 months ago

0.20.1

6 months ago

0.20.0

6 months ago

0.19.0

6 months ago

0.15.0

6 months ago

0.17.0

6 months ago

0.16.0

6 months ago

0.18.0

6 months ago

0.20.2

6 months ago

0.14.0

7 months ago

0.14.1

7 months ago

0.13.0

7 months ago

0.13.1

7 months ago

0.13.2

7 months ago

0.12.0

7 months ago

0.9.0

7 months ago

0.8.0

7 months ago

0.7.0

7 months ago

0.3.0

8 months ago

0.5.0

7 months ago

0.4.0

7 months ago

0.6.0

7 months ago

0.2.38

8 months ago

0.2.37

8 months ago

0.2.35

9 months ago

0.2.27

10 months ago

0.2.26

10 months ago

0.2.25

10 months ago

0.2.24

10 months ago

0.2.23

10 months ago

0.2.22

10 months ago

0.2.21

10 months ago

0.2.20

10 months ago

0.2.30

9 months ago

0.2.34

9 months ago

0.2.33

9 months ago

0.2.32

9 months ago

0.2.31

9 months ago

0.2.29

9 months ago

0.2.28

10 months ago

0.2.17

10 months ago

0.2.16

10 months ago

0.2.15

10 months ago

0.2.14

10 months ago

0.2.13

10 months ago

0.2.12

10 months ago

0.2.11

10 months ago

0.2.10

10 months ago

0.2.9

11 months ago

0.2.7

11 months ago

0.2.6

11 months ago

0.2.8

11 months ago

0.2.3

11 months ago

0.2.2

11 months ago

0.2.5

11 months ago

0.2.4

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.0

11 months ago

1.0.0

11 months ago

0.0.1

12 months ago