diff --git a/app/[locale]/login/page.tsx b/app/[locale]/login/page.tsx index 8c8b87e..0a3385d 100644 --- a/app/[locale]/login/page.tsx +++ b/app/[locale]/login/page.tsx @@ -1,10 +1,13 @@ -import { FC } from 'react'; +import { FC, ReactNode } from 'react'; import { Main } from '@/app/ui/Main'; import { authConfig } from "@/app/lib/auth"; import { SignInButton } from '@/app/ui/SignInButton'; import Image from 'next/image'; import { getTranslations } from "next-intl/server"; +import isWebview from "is-ua-webview"; +import { headers } from 'next/headers' +import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; type Provider = { id: string; @@ -37,6 +40,12 @@ const Page:FC = async () => { const providers = await getProviders(); const t = await getTranslations("login-page"); + // get userAgent from NextJS + + const headersList = headers(); + const userAgent = headersList.get("user-agent") as string; + + const insideWebeview = isWebview(userAgent); return (
@@ -47,14 +56,32 @@ const Page:FC = async () => {

{t("main-card.text-1")}

{t("main-card.text-2")}

- { - Object.values(providers).map((provider) => ( -
- + // Google will refuse OAuth signin if it's inside a webview (i.e. Facebook) + insideWebeview && +
+
+ +
+
+ { + t.rich("main-card.in-app-browser-warning", { + br: () =>
, + strong: (chunks:ReactNode) => {chunks}, + hint: (chunks:ReactNode) => {chunks} + }) + }
- )) +
} + + { + Object.values(providers).map((provider) => ( +
+ +
+ )) + }