From 50456c3b89490d031a16e39cff870a3b8d36c324 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 22 Jun 2022 21:58:05 +0200 Subject: [PATCH] fix: Custom domain authentication, regressed in: https://github.com/outline/outline/pull/3652 --- app/scenes/Login/AuthenticationProvider.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/scenes/Login/AuthenticationProvider.tsx b/app/scenes/Login/AuthenticationProvider.tsx index 74479a4db..3e58da287 100644 --- a/app/scenes/Login/AuthenticationProvider.tsx +++ b/app/scenes/Login/AuthenticationProvider.tsx @@ -2,9 +2,11 @@ import { EmailIcon } from "outline-icons"; import * as React from "react"; import { useTranslation } from "react-i18next"; import styled from "styled-components"; +import { parseDomain } from "@shared/utils/domains"; import AuthLogo from "~/components/AuthLogo"; import ButtonLarge from "~/components/ButtonLarge"; import InputLarge from "~/components/InputLarge"; +import env from "~/env"; import { client } from "~/utils/ApiClient"; type Props = { @@ -87,10 +89,16 @@ function AuthenticationProvider(props: Props) { ); } + // If we're on a custom domain then the auth must point to the root + // app.getoutline.com for authentication so that the state cookie can be set + // and read. + const isCustomDomain = parseDomain(window.location.origin).custom; + const href = `${isCustomDomain ? env.URL : ""}${authUrl}`; + return ( (window.location.href = authUrl)} + onClick={() => (window.location.href = href)} icon={} fullwidth >