diff --git a/scripts/setup-books-auth.py b/scripts/setup-books-auth.py index 2931358..74cf4e3 100644 --- a/scripts/setup-books-auth.py +++ b/scripts/setup-books-auth.py @@ -70,6 +70,9 @@ OIDC = [ redirect("https://chaptarr.ginnoir.com/signin-oidc"), ]), ("audiobooks", "Audiobookshelf", "audiobooks.ginnoir.com", "ABS_OIDC", [ + # ABS 2.2x+ serves under /audiobookshelf; keep the unprefixed pair too. + redirect("https://audiobooks.ginnoir.com/audiobookshelf/auth/openid/callback"), + redirect("https://audiobooks.ginnoir.com/audiobookshelf/auth/openid/mobile-redirect"), redirect("https://audiobooks.ginnoir.com/auth/openid/callback"), redirect("https://audiobooks.ginnoir.com/auth/openid/mobile-redirect"), redirect("audiobookshelf://oauth"), @@ -92,6 +95,10 @@ for slug, app_name, host, prefix, uris in OIDC: ) if created: p.property_mappings.set(SCOPES) + if p._redirect_uris != uris: + p._redirect_uris = uris + p.save() + print(f"OIDC {slug}: redirect URIs updated") Application.objects.update_or_create( slug=slug, defaults=dict(name=app_name, provider=p, meta_launch_url=f"https://{host}"), diff --git a/stacks/media/BOOKS.md b/stacks/media/BOOKS.md index 379a0b0..36b5ff4 100644 --- a/stacks/media/BOOKS.md +++ b/stacks/media/BOOKS.md @@ -43,7 +43,7 @@ sudo chown -R 1000:1000 /config/chaptarr /config/calibre-web-automated /config/a - Allowed Emails: your Authentik account email(s) - Authentik's default email mapping sends `email_verified: false`, and Chaptarr requires `true`. So the chaptarr provider uses its own mapping, `homelab: OpenID 'email' (verified)`. The app is also bound to the `ginnoir` user, so no other account can match the allowlist by changing its email. - Changing anything in `stack.env` makes Portainer recreate every media container. Don't do it while you're in the middle of a login. -- **Audiobookshelf (Pattern A):** OIDC provider `homelab-audiobooks` (pk 46) plus app `audiobooks`. Its strict redirect URIs are `https://audiobooks.ginnoir.com/auth/openid/{callback,mobile-redirect}` and `audiobookshelf://oauth`. The client ID and secret are in `stack.env` (`ABS_OIDC_CLIENT_*`). +- **Audiobookshelf (Pattern A):** OIDC provider `homelab-audiobooks` (pk 46) plus app `audiobooks`. Its strict redirect URIs are `https://audiobooks.ginnoir.com/audiobookshelf/auth/openid/{callback,mobile-redirect}` (current ABS serves under `/audiobookshelf`), the same pair without the prefix, and `audiobookshelf://oauth`. The client ID and secret are in `stack.env` (`ABS_OIDC_CLIENT_*`). **Still to do in the ABS UI** (it keeps OIDC settings in its own database): go to Settings → Authentication → OpenID Connect. - Issuer URL: `https://auth.ginnoir.com/application/o/audiobooks/`. Click *Auto-populate*, then paste the client ID and secret. - Allowed mobile redirect URIs: `audiobookshelf://oauth`.