Fix IndieAuth redirects behind /admin path
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
## Admin login
|
## Admin login
|
||||||
|
|
||||||
- The IndieKit admin is expected to run behind `/admin`.
|
- The IndieKit admin is expected to run behind `/admin`.
|
||||||
- Set `INDIEKIT_ADMIN_URL` to the public admin base URL, including trailing slash (example: `https://blog.giersig.eu/admin/`).
|
- Set `INDIEKIT_ADMIN_URL` to the public admin base URL (example: `https://blog.giersig.eu/admin` or `https://blog.giersig.eu/admin/`).
|
||||||
- When `INDIEKIT_ADMIN_URL` is set, config wires absolute auth endpoints/callback base (`/auth`, `/auth/token`, `/auth/introspect`) to that URL to keep login redirects on `/admin/*`.
|
- When `INDIEKIT_ADMIN_URL` is set, config wires absolute auth endpoints/callback base (`/auth`, `/auth/token`, `/auth/introspect`) to that URL to keep login redirects on `/admin/*`.
|
||||||
- Login uses `PASSWORD_SECRET` (bcrypt hash), not `INDIEKIT_PASSWORD`.
|
- Login uses `PASSWORD_SECRET` (bcrypt hash), not `INDIEKIT_PASSWORD`.
|
||||||
- If no `PASSWORD_SECRET` exists yet, open `/admin/auth/new-password` once to generate it.
|
- If no `PASSWORD_SECRET` exists yet, open `/admin/auth/new-password` once to generate it.
|
||||||
|
|||||||
+2
-1
@@ -37,6 +37,7 @@ const publicationBaseUrl = (
|
|||||||
const adminBaseUrl = (process.env.INDIEKIT_ADMIN_URL || "")
|
const adminBaseUrl = (process.env.INDIEKIT_ADMIN_URL || "")
|
||||||
.trim()
|
.trim()
|
||||||
.replace(/\/+$/, "");
|
.replace(/\/+$/, "");
|
||||||
|
const adminAppUrl = adminBaseUrl ? `${adminBaseUrl}/` : "";
|
||||||
const nodeEnv = (process.env.NODE_ENV || "production").toLowerCase();
|
const nodeEnv = (process.env.NODE_ENV || "production").toLowerCase();
|
||||||
const debugEnabled = process.env.INDIEKIT_DEBUG === "1" || nodeEnv !== "production";
|
const debugEnabled = process.env.INDIEKIT_DEBUG === "1" || nodeEnv !== "production";
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ export default {
|
|||||||
name: "Indiekit",
|
name: "Indiekit",
|
||||||
mongodbUrl: mongoUrl,
|
mongodbUrl: mongoUrl,
|
||||||
...(adminBaseUrl && {
|
...(adminBaseUrl && {
|
||||||
url: adminBaseUrl,
|
url: adminAppUrl,
|
||||||
authorizationEndpoint: `${adminBaseUrl}/auth`,
|
authorizationEndpoint: `${adminBaseUrl}/auth`,
|
||||||
introspectionEndpoint: `${adminBaseUrl}/auth/introspect`,
|
introspectionEndpoint: `${adminBaseUrl}/auth/introspect`,
|
||||||
tokenEndpoint: `${adminBaseUrl}/auth/token`,
|
tokenEndpoint: `${adminBaseUrl}/auth/token`,
|
||||||
|
|||||||
Reference in New Issue
Block a user