@getauthui/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/dist/authui-user-button-3yi-kvES.js +4139 -0
- package/dist/authui.cdn.js +2018 -0
- package/dist/authui.cdn.mjs +7565 -0
- package/dist/authui.d.ts +743 -0
- package/dist/authui.js +66 -0
- package/dist/react.d.ts +395 -0
- package/dist/react.js +68 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matej Bačo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Auth UI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@getauthui/core)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
**Drop-in authentication for Appwrite. One script tag, every sign-in method, MFA, sessions and account management, running on your own domain.**
|
|
7
|
+
|
|
8
|
+
```html
|
|
9
|
+
<script type="module" src="https://unpkg.com/@getauthui/core"></script>
|
|
10
|
+
|
|
11
|
+
<authui-config
|
|
12
|
+
endpoint="https://cloud.appwrite.io/v1"
|
|
13
|
+
project="my-project"
|
|
14
|
+
methods="email-password magic-url oauth:google oauth:github"
|
|
15
|
+
></authui-config>
|
|
16
|
+
|
|
17
|
+
<authui-signed-out><authui-button>Sign in</authui-button></authui-signed-out>
|
|
18
|
+
<authui-signed-in><authui-user-button></authui-user-button></authui-signed-in>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
That is a complete login flow: OAuth buttons, email and password, sign up, forgot password, passwordless email and SMS, guest sessions, MFA challenges, and a full account screen behind the avatar.
|
|
22
|
+
|
|
23
|
+
Docs: **https://getauthui.appwrite.network**
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Why v2 is a component, not a hosted page
|
|
28
|
+
|
|
29
|
+
Auth UI v1 was a hosted login page on `*.authui.site`. Browsers now block or partition third-party cookies, so a session created on one site cannot be read from another. Sign in worked in some browsers and silently failed in Safari, Firefox and Brave.
|
|
30
|
+
|
|
31
|
+
v2 runs inside your page. Its requests to Appwrite are indistinguishable from your own app's, so the session lands exactly where your code needs it. No hand-off, no tokens in URLs, no custom domain required.
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- **Sign in / sign up** with email and password, password recovery and reset
|
|
36
|
+
- **Passwordless**: magic URL, email OTP, SMS OTP, with Appwrite's security phrase
|
|
37
|
+
- **OAuth2** for every provider Appwrite supports, with brand icons for the common ones
|
|
38
|
+
- **Guest sessions** with an upgrade path to a real account
|
|
39
|
+
- **MFA**: challenges during sign in, authenticator app enrollment with QR code, recovery codes, step-up verification for protected actions
|
|
40
|
+
- **Account management**: profile, email and phone verification, password change, active sessions, connected identities, security log, account deletion
|
|
41
|
+
- **Modal, inline or headless** usage, `<authui-signed-in>` / `<authui-signed-out>` conditionals, React wrappers
|
|
42
|
+
- **Themeable**: Appwrite Console design system, dark mode that follows your page, CSS custom properties for everything, string overrides
|
|
43
|
+
- **Framework agnostic**: standard web components built with Lit, ~62 KB gzipped on the CDN including Lit and the Appwrite SDK
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
CDN:
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<script type="module" src="https://unpkg.com/@getauthui/core"></script>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
npm:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install @getauthui/core appwrite lit
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { AuthUI } from "@getauthui/core";
|
|
61
|
+
|
|
62
|
+
AuthUI.init({
|
|
63
|
+
endpoint: "https://cloud.appwrite.io/v1",
|
|
64
|
+
project: "my-project",
|
|
65
|
+
methods: { emailPassword: true, magicUrl: true, anonymous: true, oauth: ["google", "github"] },
|
|
66
|
+
branding: { name: "Acme", theme: "auto" },
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
AuthUI.on("signed-in", (user) => console.log("hello", user.name));
|
|
70
|
+
AuthUI.open(); // opens the modal
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Register your app's hostname as a **Web platform** in the Appwrite Console and enable the methods you use under **Auth → Settings**.
|
|
74
|
+
|
|
75
|
+
## Components
|
|
76
|
+
|
|
77
|
+
| Element | Purpose |
|
|
78
|
+
| -------------------------------------------- | ------------------------------------------------------------------------ |
|
|
79
|
+
| `<authui-config>` | Declarative configuration |
|
|
80
|
+
| `<authui-modal>` | Dialog that hosts sign-in and account screens (auto-created when needed) |
|
|
81
|
+
| `<authui-button>` | Opens the modal |
|
|
82
|
+
| `<authui-user-button>` | Avatar with account menu, or a sign-in button while signed out |
|
|
83
|
+
| `<authui-sign-in>` | Inline sign-in panel with every flow |
|
|
84
|
+
| `<authui-account>` | Inline account management |
|
|
85
|
+
| `<authui-signed-in>` / `<authui-signed-out>` | Render children for one auth state |
|
|
86
|
+
|
|
87
|
+
React: `import { AuthUIProvider, AuthUIButton, AuthUIUserButton, SignedIn, SignedOut, useAuthUI } from "@getauthui/core/react"`.
|
|
88
|
+
|
|
89
|
+
## Repository layout
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
packages/core @getauthui/core, the Lit component library
|
|
93
|
+
docs Landing page and documentation (Next.js + Fumadocs, static export)
|
|
94
|
+
example Vite playground that exercises every component
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Development
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pnpm install
|
|
101
|
+
pnpm dev:core # build the library in watch mode
|
|
102
|
+
pnpm dev:docs # docs site on http://localhost:3100
|
|
103
|
+
pnpm --filter example dev # example app on http://localhost:5174
|
|
104
|
+
pnpm test # unit tests (vitest + jsdom, Appwrite mocked)
|
|
105
|
+
pnpm check && pnpm lint && pnpm format:check
|
|
106
|
+
pnpm build # library build: ESM + types, CDN ESM and IIFE bundles
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
MIT
|