0.4.14 • Published 5 days ago

@a-type/auth v0.4.14

Weekly downloads
-
License
MIT
Repository
-
Last release
5 days ago

auth

My personal library for API authentication.

Designed to plug into itty-router based servers.

Users

This library has some opinions about what a user is.

A user has:

  • id
  • email
  • fullName (a formal name, provided by OAuth provider or the user themselves)
  • friendlyName (an informal, changeable name shown to other people)

Login flows

This library powers OAuth-based login flows with specified providers.

It also enables an email login flow with email+password, including email verification and password resets.

Email flow

The email flow is fairly opinionated.

First, submit a request handled by handlers.handleSendEmailVerificationRequest to verify the user owns the email. They must provide email and name (fullName).

This creates an email verification token in the database and sends them an email with a code.

The user then clicks the link in the email to return to the app with the code. Upon presenting the code, they must then choose a password. The code and password are sent back to the server to the handlers.handleVerifyEmailRequest handler. This creates the user's account and identity on the server and sets up email login.

Password reset works fairly similarly - send a request to send the password reset email, get the code, return and set a new password.

0.4.14

5 days ago

0.4.13

13 days ago

0.4.11

20 days ago

0.4.12

20 days ago

0.4.9

24 days ago

0.4.8

29 days ago

0.4.5

29 days ago

0.4.7

29 days ago

0.4.6

29 days ago

0.4.4

2 months ago

0.4.3

2 months ago

0.4.2

2 months ago

0.3.9

2 months ago

0.3.10

2 months ago

0.3.8

2 months ago

0.3.7

2 months ago

0.4.1

2 months ago

0.4.0

2 months ago

0.3.6

2 months ago

0.3.0

2 months ago

0.3.5

2 months ago

0.3.2

2 months ago

0.3.1

2 months ago

0.3.4

2 months ago

0.3.3

2 months ago

0.2.1

2 months ago

0.2.0

2 months ago

0.1.4

2 months ago

0.1.3

2 months ago

0.1.2

3 months ago

0.1.1

3 months ago

0.1.0

4 months ago