Skip to content

Commit a23131e

Browse files
committed
Simplify home page
1 parent daa0cd7 commit a23131e

4 files changed

Lines changed: 98 additions & 372 deletions

File tree

docs/src/index.md

Lines changed: 16 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -51,57 +51,9 @@ flowchart TB
5151

5252
---
5353

54-
## Documentation
55-
56-
### Core Concepts
57-
58-
| Document | Description |
59-
|----------|-------------|
60-
| [**Overview**](overview.md) | Auth flow, JWT validation, user mapping |
61-
| [**Web Component**](web-component.md) | `<hotosm-auth>` Lit element |
62-
63-
---
64-
65-
## Packages
66-
67-
### Python
68-
69-
```bash
70-
# Core only
71-
pip install hotosm-auth==0.2.10
72-
73-
# With FastAPI
74-
pip install "hotosm-auth[fastapi]==0.2.10"
75-
76-
# With Django
77-
pip install "hotosm-auth[django]==0.2.10"
78-
```
79-
80-
### Web Component
81-
82-
Published to npm as `@hotosm/hanko-auth`.
83-
84-
```bash
85-
# React/Vite projects
86-
pnpm add @hotosm/hanko-auth
87-
```
88-
89-
```javascript
90-
import '@hotosm/hanko-auth';
91-
// <hotosm-auth> is now registered
92-
```
93-
94-
For server-rendered apps (no bundler), load from CDN:
95-
96-
```html
97-
<script type="module" src="https://cdn.jsdelivr.net/npm/@hotosm/hanko-auth@0.5.2/dist/hanko-auth.esm.js"></script>
98-
```
99-
100-
---
101-
10254
## Quick Start
10355

104-
### FastAPI (5 min)
56+
### FastAPI
10557

10658
```python
10759
# main.py
@@ -118,29 +70,20 @@ async def lifespan(app: FastAPI):
11870

11971
app = FastAPI(lifespan=lifespan)
12072

121-
# Mount OSM OAuth routes
122-
# router already has prefix="/auth/osm" → routes: /api/auth/osm/login, /api/auth/osm/callback
12373
app.include_router(osm_router, prefix="/api")
12474

125-
# Protected endpoint
12675
@app.get("/me")
12776
async def me(user: CurrentUser):
12877
return {"id": user.id, "email": user.email}
12978
```
13079

131-
### Django (5 min)
80+
### Django
13281

13382
```python
13483
# settings.py
135-
INSTALLED_APPS = [
136-
...
137-
'hotosm_auth_django',
138-
]
84+
INSTALLED_APPS = [..., 'hotosm_auth_django']
13985

140-
MIDDLEWARE = [
141-
...
142-
'hotosm_auth_django.HankoAuthMiddleware',
143-
]
86+
MIDDLEWARE = [..., 'hotosm_auth_django.HankoAuthMiddleware']
14487

14588
# views.py
14689
from hotosm_auth_django import login_required
@@ -156,97 +99,32 @@ def my_view(request):
15699
```html
157100
<hotosm-auth
158101
hanko-url="https://login.hotosm.org"
159-
osm-required
160102
redirect-after-login="/"
161103
></hotosm-auth>
162104
```
163105

164106
---
165107

166-
## Environment Variables
167-
168-
```bash
169-
# Required
170-
HANKO_API_URL=https://login.hotosm.org
171-
COOKIE_SECRET=your-32-char-secret
172-
173-
# OSM OAuth (enables OSM linking when both are set)
174-
OSM_CLIENT_ID=your-osm-client-id
175-
OSM_CLIENT_SECRET=your-osm-client-secret
176-
OSM_REDIRECT_URI=https://your-app/api/auth/osm/callback # auto-generated if not set
177-
OSM_SCOPES=read_prefs # default: read_prefs
178-
OSM_API_URL=https://www.openstreetmap.org
108+
## Reference
179109

180-
# Cookie (auto-detected from HANKO_API_URL when not set)
181-
COOKIE_DOMAIN=.hotosm.org
182-
COOKIE_SECURE=true
183-
COOKIE_SAMESITE=lax
184-
185-
# JWT
186-
JWT_ISSUER=https://login.hotosm.org # default: auto (uses HANKO_API_URL)
187-
JWT_AUDIENCE=your-app-audience
188-
189-
# Admin
190-
ADMIN_EMAILS=admin@hotosm.org # comma-separated
191-
```
110+
| Document | Description |
111+
|----------|-------------|
112+
| [**Overview**](overview.md) | Auth flow, JWT validation, user mapping, env vars |
113+
| [**Python Libraries**](python-libs.md) | `hotosm_auth`, `hotosm_auth_fastapi`, `hotosm_auth_django` |
114+
| [**Web Component**](web-component.md) | `<hotosm-auth>` Lit element — attributes, events, modes |
192115

193116
---
194117

195-
## Source Repository
118+
## Guides
196119

197-
```
198-
github.com/hotosm/login
199-
├── backend/
200-
├── frontend/
201-
├── auth-libs/ # ← Auth libraries
202-
│ ├── python/
203-
│ │ ├── src/
204-
│ │ │ ├── hotosm_auth/ # Core (JWT, config, crypto)
205-
│ │ │ │ ├── config.py
206-
│ │ │ │ ├── crypto.py
207-
│ │ │ │ ├── exceptions.py
208-
│ │ │ │ ├── jwt_validator.py
209-
│ │ │ │ ├── models.py
210-
│ │ │ │ ├── osm_oauth.py
211-
│ │ │ │ └── schemas/
212-
│ │ │ ├── hotosm_auth_fastapi/ # FastAPI integration
213-
│ │ │ │ ├── dependencies.py
214-
│ │ │ │ ├── osm_routes.py
215-
│ │ │ │ ├── db_models.py
216-
│ │ │ │ ├── admin.py
217-
│ │ │ │ ├── admin_routes.py
218-
│ │ │ │ └── setup.py
219-
│ │ │ ├── hotosm_auth_django/ # Django integration
220-
│ │ │ │ ├── middleware.py
221-
│ │ │ │ ├── osm_views.py
222-
│ │ │ │ ├── models.py
223-
│ │ │ │ ├── admin_routes.py
224-
│ │ │ │ └── migrations/
225-
│ │ │ └── hotosm_auth_litestar/ # Litestar integration
226-
│ │ │ ├── dependencies.py
227-
│ │ │ ├── osm_routes.py
228-
│ │ │ ├── admin.py
229-
│ │ │ ├── admin_routes.py
230-
│ │ │ └── setup.py
231-
│ │ └── pyproject.toml
232-
│ ├── web-component/
233-
│ │ ├── src/
234-
│ │ │ ├── hanko-auth.ts # Main Lit component
235-
│ │ │ ├── hanko-auth.styles.ts
236-
│ │ │ ├── hanko-translations.ts
237-
│ │ │ ├── hanko-i18n-en.ts
238-
│ │ │ ├── hanko-i18n-es.ts
239-
│ │ │ ├── hanko-i18n-fr.ts
240-
│ │ │ └── hanko-i18n-pt.ts
241-
│ │ └── dist/ # Published as @hotosm/hanko-auth on npm
242-
│ └── scripts/
243-
│ └── build.sh # Build all
244-
└── ...
245-
```
120+
| Document | Description |
121+
|----------|-------------|
122+
| [**Integration Guide**](integration-guide.md) | Step-by-step guide to integrate auth in a new app |
123+
| [**Admin**](admin.md) | Manage user mappings via the login service dashboard |
246124

247125
---
248126

249-
## Project Implementations
127+
## Implementations
250128

251129
| Project | Stack | Documentation |
252130
|---------|-------|---------------|

0 commit comments

Comments
 (0)