Shared auth across standalone app modules #28
Labels
No labels
app:activities
app:chat
app:events
app:forum
app:libra
app:market
app:restaurant
app:tasks
app:wallet
app:webapp
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aiolabs/webapp#28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Each standalone app (Castle, Sortir/Eventos) requires a separate login because they're on different subdomains with isolated localStorage. Users must authenticate on each app independently.
Moved from aiolabs/atio-home#1.
Current workaround
Standalone apps accept
?token=<access_token>in the URL. The main app can link tosortir.ariege.io?token=xxxto relay the session. Not production-grade (token in browser history/logs).Approaches considered
1. Route-based modules (near-term, recommended)
Serve standalone apps as routes under the main app domain instead of separate subdomains:
app.ariege.io/sortirinstead ofsortir.ariege.ioapp.ariege.io/castleinstead ofcastle.ariege.ioapp.ariege.io/eventosinstead ofeventos.atitlan.ioPros: Same origin = same localStorage = shared auth. No backend changes. No CORS issues.
Cons: Need to ensure standalone app routes don't conflict with main app routes. PWA manifest/service worker scope needs configuration per path prefix. Build pipeline needs to output to subdirectories.
2. Cookie-based auth (
Domain=.ariege.io)LNbits sets
HttpOnlycookie withDomain=.ariege.ioon login. All subdomains share the session automatically.Pros: Clean, standard web pattern. Works with existing subdomain setup.
Cons: Requires LNbits backend changes. CORS configuration needed. Different domains per deployment (ariege.io vs atitlan.io vs aiolabs.dev).
3. Nostr-based auth (long-term)
Since every user has a Nostr keypair, standalone apps could authenticate via NIP-98 (signed HTTP auth) or a challenge-response flow. The private key is stored in the main app; standalone apps request signing via postMessage or a shared worker.
Pros: Aligns with Nostr-native goal. No cookies/tokens needed. Works across any domain.
Cons: No established PWA pattern for this yet. Key storage/sharing across origins is the hard part.
Recommendation
Start with approach 1 (route-based) for near-term. It's the simplest and doesn't require backend changes. The standalone apps already build to separate dist directories — just need nginx to serve them under path prefixes on the main app domain.
Related