:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(oauth): align the OAuth screens with the login pages (#101343)
Rafael Audibert1b314c1f05ff
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 242ddaf0bcee..8d034ff8f72a 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -1604,6 +1604,18 @@ snapshots:hash: v1.k794b7964.61756e28fa0da0684f89895942153311367644c95311436bf5538ce241657f90.6-Z4GWvaK_AeFMQ_gv_UNSBlfESLHU2S9EBGbJ795KMcomponents-not-found--not-found--light:hash: v1.k794b7964.ef3247e1f5c8360e264349da02724c306672e837b42f16ad74a8fad9d1219d02.A0XX2XEOCK7YQYtIRtCKo0SB4kHqS_vBHaH141IrbEE+ components-oauth-connection-logos--broken-logo--dark:+ hash: v1.k794b7964.9e8e6d61c4484e125eede42304b6f38a2ecc96ef84818d2e9e07eb02607accbf.J1zRnFl4_rbeScN1BSh09dqW8mhinsbZxdE9PEWzqNw+ components-oauth-connection-logos--broken-logo--light:+ hash: v1.k794b7964.76669465d3b4dddf9fd33d45bb09f1db0e05f78aeb14e8c64940db1a81d9aab0.N9Td2xmjU22juReZFAmBFCvJ7RWnKgQkxHMYFrFa698+ components-oauth-connection-logos--with-logo--dark:+ hash: v1.k794b7964.c6713b67e0825fcbaddf9a5161ac218cc10b7b37e0b76989546af3ccc9e2170f.BgdGrVUOhTti04YuJiDOFf64LC0C6bIjmmcmTcFyK78+ components-oauth-connection-logos--with-logo--light:+ hash: v1.k794b7964.ada4261a542447f12d0f896d64fa07c776083499e8d50fe264eb5529b6aa92c5.vS-uZ_4tH1vaKaV-9BIrq2MBpzFVmrzlrZTqkLh_uBQ+ components-oauth-connection-logos--without-logo--dark:+ hash: v1.k794b7964.9e8e6d61c4484e125eede42304b6f38a2ecc96ef84818d2e9e07eb02607accbf.UHsxNwfUnwWBY7bE6K812O-LImDiM_tdY2moYXIQCT4+ components-oauth-connection-logos--without-logo--light:+ hash: v1.k794b7964.76669465d3b4dddf9fd33d45bb09f1db0e05f78aeb14e8c64940db1a81d9aab0.kkQspWJQLQTm73qg8wVkXhF8XnAdVcSzRnneE1ZywlUcomponents-pay-gate-mini--pay-gate-mini--dark:hash: v1.k794b7964.42a516cf3e11bb319673f4b0fd69efd4150fca0477d502749a36ba338da33e05.tM1QnvnZagRnjAU2zw0xRjujJMSapGoK_xbKBITppmQcomponents-pay-gate-mini--pay-gate-mini--light:@@ -9757,45 +9769,49 @@ snapshots:scenes-app-notebooks-widget-views--workflow-views--light:hash: v1.k794b7964.cd7fa77d9236079839583863834cd6f2a7a0aea88be4bdb1fb68e4e9c0ab4dab.df8Gy7QN0LSBis_grrNFZCyPlgTJV9k90oTKS9o2ouIscenes-app-oauth-authorize--access-controls-apply--dark:- hash: v1.k794b7964.2268c82adb701899471a901fb008d250988c8443985ed232003ca12295b1d921.i8DoC2hnX3sWU5b-vb4iYAhnFb8ZMMlXM4F1KBUYEhk+ hash: v1.k794b7964.4f421d7fb891d0a77a0211d80ec9efc6899b84fb14cf331833cd175bdc738b10.doktEISQ1Rqmw7byfMxsgoY3VnXeI5pvbAXUr8yfsT0scenes-app-oauth-authorize--access-controls-apply--light:- hash: v1.k794b7964.fea1155c17aac8781f826253e9518af5be6bbcc077d1fca1661d11396b86fe49.mV_6zj24dUY_Di77iUM35r40WPSxuLKJbvFtiELPWDM+ hash: v1.k794b7964.c0af4f52e12413df84b314dfd97fe211228e6eba22a46c506f014e5c519e9c81.zQbQZB7mkQ8YILGkqI_Exzd7a5p9XqqXywrwE96dENUscenes-app-oauth-authorize--all-scopes-optional--dark:- hash: v1.k794b7964.a03d00f6626add00255abe8fa712c056cecbf929f724284de20cf6e936a96fbe.cCaJ_N0193dGvxNreYfm9ltl9zmGo4r3-9-vKCX7TwQ+ hash: v1.k794b7964.767c19354279e9bb950cc43ef82110119dbc2116300699a9adb0a049502221da.M09_tyl5B3_tDrOsts_8LKn6JwktVVhIF48ZlPNjW0Mscenes-app-oauth-authorize--all-scopes-optional--light:- hash: v1.k794b7964.c5df50e3b5aab5d9e8e72a8a5a59f20533ea58b250ff693fad28296367c76203.H7kQMrLhjAVxuAT4GjPXtSZQyT4jhPUcG8Tu57d1dOo+ hash: v1.k794b7964.56cc992661af638417667462d39ecee57d74888486f9ae5214589e6fe56a0556.0mf8IIL0CVmLZS8QnPov2_5t5XetGeSjGK9TGEujRQMscenes-app-oauth-authorize--all-scopes-required--dark:- hash: v1.k794b7964.b6696ed69bdd01cf3c010db9d9dc4e6e21d708c7ab9bea21d76bd377182d6465.3I_xmg16lwpnJPf3jCfnt8jY0Vbr9P9wTNANmwJ4Rb4+ hash: v1.k794b7964.5c178e68dcf7ae3beeeeb18fc72f22f4ac33198230c3d03201e211f6f52c3706.RqPOVoCSmFGY1jWdGDf3esZFkOueSvAJHKmJBp7vpvkscenes-app-oauth-authorize--all-scopes-required--light:- hash: v1.k794b7964.317c60eee73133c8051fa95326ae8a2862eab42e9233cfd007f444455efa3f3f.7VMT28J9VYZhVLYqo9_DmEe7YS2PSR67YEbXtfOGxz0+ hash: v1.k794b7964.03c7a17fdfde23344713839c0fcc53085da6160cece0e5f5ed893f701e9912db.nzLi2CnG6ZtBV_X6kZHVTWTYSU3PSn8mKjLqwk5UOcgscenes-app-oauth-authorize--default-scopes--dark:- hash: v1.k794b7964.d3709da69b5399ed5ebead357f9c3ad67e11dc3eb3a89686761993305f94167d.wa5J78hx0IwF0sieeuEN2W5jBUuLXU55szPCcwSOYv4+ hash: v1.k794b7964.986767f854575bc076567098bc9284bebe23bb9d6cb98e9ce5f1615d7df0c1c8.kbh-ZWkN26OjfOLfAvKWancysKB5gLTFVfm-WayZRWYscenes-app-oauth-authorize--default-scopes--light:- hash: v1.k794b7964.f9da299cdeeb3397023e1680fa42457beaf7a77f86a3e7facc6af59af48529f5.Nyb2OYCDSrBBG4qSmSVXD68yWaiUZ-jaOS9hXG8QJGw+ hash: v1.k794b7964.c17d5f85d3c4f464500b0cf6875f055dcff866f1715e8c1052fbf60da1098aca.ssoXjuvF0tewN9PAvdmkfmQhw7D55dH61HmpqdJLT-Escenes-app-oauth-authorize--every-scope-requested--dark:- hash: v1.k794b7964.98089d8de3f151cf3f8f288fa0e1889b1bec56a18221d4ed5ce1272c1c45d48d.RQRLSRKg5BdWJcWkecHsnfNxRsM4hQCWrZibVkGTc9U+ hash: v1.k794b7964.5b544e241fa57ad7971a6872fce18c2d3e9dbbcfd5c6b4e2a861cc60683a7eda.SymJ-itmx0Mon5EALqTxh99r_VbtywIv8gFXju-9wRsscenes-app-oauth-authorize--every-scope-requested--light:- hash: v1.k794b7964.238f7ce66141023589a5f50812a8f4fe05022bf96569cdec5bfb5aa2a385f5f6.Yeq6LBJIbRqCNpyMPwyja0jmhfi8HyGX6Bv4o7Aep6Y+ hash: v1.k794b7964.b5580b7ac56a2cc10607f9cc25789a353546f52dd79486bbe5139d4b0763738d.r-tI9Tyc1rXEe8K7vrZWug-yDlpq1X80lJMiIddxqHAscenes-app-oauth-authorize--every-scope-requested-scrolled-to-end--dark:- hash: v1.k794b7964.98089d8de3f151cf3f8f288fa0e1889b1bec56a18221d4ed5ce1272c1c45d48d.nx1s7QkTpK8rq5W8edIggvrgQwXf-KOlmXqYZtN9_cU+ hash: v1.k794b7964.5b544e241fa57ad7971a6872fce18c2d3e9dbbcfd5c6b4e2a861cc60683a7eda.gLSvVEeKbmA7YUlD7Jw056daksT3C2VpGN86wBKJkMUscenes-app-oauth-authorize--every-scope-requested-scrolled-to-end--light:- hash: v1.k794b7964.238f7ce66141023589a5f50812a8f4fe05022bf96569cdec5bfb5aa2a385f5f6.QSUMFvFn8dz52CWyDfHydM-BDTgb3OVG8d0KnvPOCIU+ hash: v1.k794b7964.b5580b7ac56a2cc10607f9cc25789a353546f52dd79486bbe5139d4b0763738d.cqBVJHNSXNfqJ5R-NS-CnNdIZv56Hm9Q74xPi0bOBx4scenes-app-oauth-authorize--many-optional-scopes--dark:- hash: v1.k794b7964.dfaac1cfdc53f1eb86edb541c52e731bc26edf546eb17693e3a2aeaf93e12fec.rqOthtnE_JqlShgBX6MZrhh7e4JcqUURVA6CanXqdUU+ hash: v1.k794b7964.ed7236b791f1885a80c8e308825334ea9c1fb33c67cbae1aa98c6fae12ff8c6d.wjzy_8MW69AdymaJU2hQR00ZPRM87GUk2hGbQuI-sE8scenes-app-oauth-authorize--many-optional-scopes--light:- hash: v1.k794b7964.dc93c3357c7b0ace4184f09adb1e9542778be9103f5685ed270fc64de4b65b48.6uxZObDDBvBtazPXBlxmwMYNei9nASz2LXN6DTKic00+ hash: v1.k794b7964.60f3021e99d97e7ae17dd9f7e14e544490782b116a5d310af004e341f4742a5d.76J58bJGA_qnljF8s4V1xlIQuZP7VIMAWHvsk-NXrq0scenes-app-oauth-authorize--required-read-floor-with-optional-write--dark:- hash: v1.k794b7964.b4148f30d47222b3a0523d25215ab088dd0da5cb17955f07cbbd62361b2d8a08.-cjh16yvI6CDheUdOCWB4FwkztEyU7K2oxTzrbHwojA+ hash: v1.k794b7964.ce56f2483e994a71329cb4680e6d27de7d21826ad659cde1e3aacef4d5fa76e9.q2kyWCaocImuyB_NYXx6kCgzekEe2ULgO-PzTVd0J3wscenes-app-oauth-authorize--required-read-floor-with-optional-write--light:- hash: v1.k794b7964.2e5a2e128728c4771a4470f7737d528c6bf83d22e5182885167ac3486ff8f81a.Wg_f72BthHwfWm2Mxbub5vE7ocGrV0GufENr9YP61z0+ hash: v1.k794b7964.ba1df8cc7fe1f3431880aac8eeb18dd0c0b3d5ff0d6c9c9e04190dc85e734bc1.FMEaatH9lH-BnltaSdnCCXboYKpLaMBQ3dOrqkSUPf8scenes-app-oauth-authorize--wildcard-scope--dark:- hash: v1.k794b7964.4ec7fd1ec1a387074e8b442cdd52ea1664668d36e5fca932cbec7378ed4faa8d.tSMSz9Ou8eGdHkqTaZeowWlSAq5OAYRB13vH739d4II+ hash: v1.k794b7964.9b96958067dc05edc0e8fcbe6192e5bd4b01a3c4b8a346a4e69e7ec6008397d8.gu62zWdVnryoqleY_jEV76T8ym5U7kyZvMovNElPAmsscenes-app-oauth-authorize--wildcard-scope--light:- hash: v1.k794b7964.ff3affb7020ae195a8c8775b9493ea203ccf2c8cea44b66d95656978dcc782cb.oyia-epNaBoceefOyHpB_vOiTsCMMqHMk9yX2xPdIQo+ hash: v1.k794b7964.92689415467144e6534ee927866e25f4e855163f9a16b175f823c64a752e6ee2.XMeoQbtgFDkLFk_v4q287DleLU4npkwAawppAPNJouw+ scenes-app-oauth-authorize--with-application-logo--dark:+ hash: v1.k794b7964.945c0d75c83bfac039e99f66e8524ab3bd82a3cd4ede7da12b1ef831e77194b3.NrzqHM_SIujBzqtARGo8QxTVR5EHYWrFyDANxfIDIcc+ scenes-app-oauth-authorize--with-application-logo--light:+ hash: v1.k794b7964.34838482a345917e9b34018a2571c77ebfe548edacffd71d0470a0e3ae1bd860.n1C5JIFO_pnLYRxE4_Ok6rEUFiocT7KCN7hanFeeBHUscenes-app-oauth-authorize--with-required-scopes--dark:- hash: v1.k794b7964.92f0ad767dabd67339b0164bceda47f16956ca5cfe785dd9463be7f7624e31cd.vY24DLkHfCewBtRsMGJsJqEAeiG2j3kvlgLp0kiMUig+ hash: v1.k794b7964.f078f02667fddd8216ec0782c45f1fb95d8bbe6cae9887643e00f284216027cd.Zm5Vw89T37jz_UtxgdvbtIYH3Xo6X-pVxNK28AxFNiEscenes-app-oauth-authorize--with-required-scopes--light:- hash: v1.k794b7964.1d5ff93033559a81f3d12e8f641f0f28382dcc41781640420de8b09dc581a763.Kmsdq1TTaLuk1gI60TGjlQLDNuWaVQmnqcs_oEetJME+ hash: v1.k794b7964.45df46d0f04131e089b74503a4066bc3a21995fd5096ceba882c8e39b651136c.ftk-4hgGc2ue_2uxUGcENeFd8o8gkz0OB6UYat5OLp8scenes-app-people-cohorts--cohort-edit-dynamic--dark:hash: v1.k794b7964.64bc82476828e61d420a9fc2ef3c550d45acf9c24f8d0bec694f803ecd147df7.eqlptg68mBa-l30eKEMGIEqcHeTSh2GAlhd0ybVid-kscenes-app-people-cohorts--cohort-edit-dynamic--light:diff --git a/frontend/src/lib/components/OAuthConnectionLogos/OAuthConnectionLogos.stories.tsx b/frontend/src/lib/components/OAuthConnectionLogos/OAuthConnectionLogos.stories.tsxnew file mode 100644index 000000000000..3b5680c3685c--- /dev/null+++ b/frontend/src/lib/components/OAuthConnectionLogos/OAuthConnectionLogos.stories.tsx@@ -0,0 +1,25 @@+import type { Meta, StoryObj } from '@storybook/react'++import { OAuthConnectionLogos } from './OAuthConnectionLogos'++const meta: Meta<typeof OAuthConnectionLogos> = {+ title: 'Components/OAuth connection logos',+ component: OAuthConnectionLogos,+ tags: ['autodocs'],+}+export default meta++type Story = StoryObj<typeof OAuthConnectionLogos>++export const WithLogo: Story = {+ // Served from frontend/public, so the snapshot never reaches out to a host we do not control.+ args: { appName: 'Zapier', logoUri: '/static/services/zapier.png' },+}++export const WithoutLogo: Story = {+ args: { appName: 'Zapier', logoUri: null },+}++export const BrokenLogo: Story = {+ args: { appName: 'Zapier', logoUri: '/static/services/this-icon-does-not-exist.png' },+}diff --git a/frontend/src/scenes/authentication/shared/authScene/PendingOAuthConnectionLogos.tsx b/frontend/src/lib/components/OAuthConnectionLogos/OAuthConnectionLogos.tsxsimilarity index 66%rename from frontend/src/scenes/authentication/shared/authScene/PendingOAuthConnectionLogos.tsxrename to frontend/src/lib/components/OAuthConnectionLogos/OAuthConnectionLogos.tsxindex e8bb7f3e3bda..e182edab6e30 100644--- a/frontend/src/scenes/authentication/shared/authScene/PendingOAuthConnectionLogos.tsx+++ b/frontend/src/lib/components/OAuthConnectionLogos/OAuthConnectionLogos.tsx@@ -4,30 +4,30 @@ import { IconPlug } from '@posthog/icons'import { Logomark } from 'lib/brand'-import type { PendingOAuthConnection } from '../pendingOAuthConnectionLogic'--export function PendingOAuthConnectionLogos({ connection }: { connection: PendingOAuthConnection }): JSX.Element {+export function OAuthConnectionLogos({ appName, logoUri }: { appName: string; logoUri: string | null }): JSX.Element {const [logoFailed, setLogoFailed] = useState(false)- const logoUri = logoFailed ? null : connection.logoUri+ const resolvedLogoUri = logoFailed ? null : logoUrireturn (+ // pinned: `data-attr` value read by autocapture dashboards, so it keeps the name it was+ // first shipped under on the login page.<div className="flex items-center justify-center gap-3 mb-4" data-attr="pending-oauth-connection-logos"><span className="flex items-center justify-center w-12 h-12 p-2.5 rounded-full border border-border bg-bg-light">- <Logomark variant="gradient" size="sm" />+ <Logomark size="sm" /></span><IconPlug className="text-secondary text-lg shrink-0" aria-hidden /><span className="flex items-center justify-center w-12 h-12 rounded-full border border-border bg-bg-light overflow-hidden">- {logoUri ? (+ {resolvedLogoUri ? (<img- src={logoUri}- alt={`${connection.clientName} logo`}+ src={resolvedLogoUri}+ alt={`${appName} logo`}className="w-8 h-8 object-contain"referrerPolicy="no-referrer"onError={() => setLogoFailed(true)}/>) : (<span className="text-lg font-semibold text-primary" aria-hidden>- {connection.clientName.charAt(0).toUpperCase()}+ {appName.charAt(0).toUpperCase()}</span>)}</span>diff --git a/frontend/src/scenes/authentication/invite-signup/InviteSignupForm.tsx b/frontend/src/scenes/authentication/invite-signup/InviteSignupForm.tsxindex 73fa2d0dd691..a5d8958ba34a 100644--- a/frontend/src/scenes/authentication/invite-signup/InviteSignupForm.tsx+++ b/frontend/src/scenes/authentication/invite-signup/InviteSignupForm.tsx@@ -119,7 +119,7 @@ function InviteNewUser({ invite }: { invite: PrevalidatedInvite }): JSX.Element<div className="flex gap-3 items-center"><OrgTile name={org} /><span className="AuthScene__inviteHeader-mark inline-flex opacity-90">- <Logomark variant="gradient" size="md" />+ <Logomark size="md" /></span></div><div className="text-center">diff --git a/frontend/src/scenes/authentication/shared/authScene/AuthCardTitle.tsx b/frontend/src/scenes/authentication/shared/authScene/AuthCardTitle.tsxindex aa449824d8ea..6677bee35568 100644--- a/frontend/src/scenes/authentication/shared/authScene/AuthCardTitle.tsx+++ b/frontend/src/scenes/authentication/shared/authScene/AuthCardTitle.tsx@@ -12,7 +12,7 @@ export function AuthCardTitle({return (<div className={className ?? 'mb-6'}><h1 className="m-0 text-xl font-bold leading-tight text-center tracking-tight">{title}</h1>- {sub && <p className="mt-2 mb-0 text-sm text-gray-600 text-center text-pretty">{sub}</p>}+ {sub && <p className="mt-2 mb-0 text-sm text-secondary text-center text-pretty">{sub}</p>}</div>)}diff --git a/frontend/src/scenes/authentication/shared/authScene/AuthScene.scss b/frontend/src/scenes/authentication/shared/authScene/AuthScene.scssindex 310a98613d93..0b652a03723a 100644--- a/frontend/src/scenes/authentication/shared/authScene/AuthScene.scss+++ b/frontend/src/scenes/authentication/shared/authScene/AuthScene.scss@@ -1,4 +1,5 @@-// Unauthenticated auth scenes are forced light.+// Unauthenticated auth scenes paint their own backdrop and card instead of using the app+// surfaces, so every color they use has to be declared for both themes.// Only rules that cannot be expressed in Tailwind utilities live here:// pseudo-elements, interactive pseudo-class combinators, child selectors, keyframes.@@ -9,35 +10,77 @@--primary-3000-button-border-hover: var(--primary-3000-button-border-hover-light);--color-text-warning: var(--color-text-primary);- background-color: #b5cd8f;+ // The dark-mode block below is the only thing that repaints these.+ --auth-scene-backdrop-top: #cfe0ae;+ --auth-scene-backdrop-mid: #b5cd8f;+ --auth-scene-backdrop-bottom: #9dbb78;+ --auth-scene-backdrop-glow: rgb(255 253 240 / 45%);+ --auth-scene-backdrop-ink: rgb(45 74 22 / 65%);+ --auth-scene-card-bg: #f6f5f0;+ --auth-scene-card-border: #e3e0d4;+ --auth-scene-card-shadow: rgb(30 50 10 / 25%);+ --auth-scene-card-ink: #111;+ --auth-scene-card-ink-muted: rgb(17 17 17 / 58%);++ background-color: var(--auth-scene-backdrop-mid);background-image:- radial-gradient(80% 70% at 50% 30%, rgb(255 253 240 / 45%), transparent 70%),- linear-gradient(180deg, #cfe0ae 0%, #b5cd8f 55%, #9dbb78 100%);+ radial-gradient(80% 70% at 50% 30%, var(--auth-scene-backdrop-glow), transparent 70%),+ linear-gradient(+ 180deg,+ var(--auth-scene-backdrop-top) 0%,+ var(--auth-scene-backdrop-mid) 55%,+ var(--auth-scene-backdrop-bottom) 100%+ );background-repeat: no-repeat;background-size: auto;// The cream OS-window card the new website (and the self-driving onboarding) uses.+ .AuthScene__card,+ .AuthScene__cardSurface {+ background: var(--auth-scene-card-bg);+ }+.AuthScene__card {- background: #f6f5f0;- border-color: #e3e0d4;+ border-color: var(--auth-scene-card-border);border-radius: 1rem;- box-shadow: 0 16px 40px rgb(30 50 10 / 25%);+ box-shadow: 0 16px 40px var(--auth-scene-card-shadow);}- // Corner notes read as dark-green ink on the garden rather than gray on parchment.+ // Corner notes read as ink on the backdrop rather than gray on parchment..AuthScene__notes div {- color: rgb(45 74 22 / 65%);+ color: var(--auth-scene-backdrop-ink);}}+// The backdrop and the card are both opaque, so dark mode has to repaint them. Without this the+// scene keeps its light sheets under the light-on-dark text the app tokens switch to.+[theme='dark'] .AuthScene {+ --auth-scene-backdrop-top: #1b2a10;+ --auth-scene-backdrop-mid: #14200b;+ --auth-scene-backdrop-bottom: #0d1707;+ --auth-scene-backdrop-glow: rgb(157 187 120 / 12%);+ --auth-scene-backdrop-ink: rgb(207 224 174 / 65%);+ --auth-scene-card-bg: var(--color-bg-surface-primary);+ --auth-scene-card-border: var(--color-border-primary);+ --auth-scene-card-shadow: rgb(0 0 0 / 45%);+ --auth-scene-card-ink: var(--color-text-primary);+ --auth-scene-card-ink-muted: var(--color-text-secondary);+}++// A band that sits flush inside a card, such as a sticky section header. It repeats the card's+// own background so it does not read as a second sheet stacked on the first.+.AuthScene__cardSurface {+ background: var(--auth-scene-card-bg, #fff);+}+// Paper sheet resting on the desk — the login card and the dev login panel share it..AuthScene__card {- background: #fff;- border: 1px solid #e0e1d9;+ background: var(--auth-scene-card-bg, #fff);+ border: 1px solid var(--auth-scene-card-border, #e0e1d9);border-radius: var(--radius-lg);box-shadow:0 20px 44px -26px rgb(40 38 30 / 35%),- 0 3px 0 #e0e1d9;+ 0 3px 0 var(--auth-scene-card-border, #e0e1d9);}// Child SVG sizing — child selector, no Tailwind equivalent@@ -67,7 +110,7 @@.AuthScene__mono {font-family: var(--font-mono);font-size: 13px;- color: #111;+ color: var(--auth-scene-card-ink, #111);}}@@ -75,7 +118,7 @@.AuthScene__terms {a {font-weight: 600;- color: rgb(17 17 17 / 58%);+ color: var(--auth-scene-card-ink-muted, rgb(17 17 17 / 58%));text-decoration: underline;text-underline-offset: 2px;}@@ -84,7 +127,7 @@// Note callout — bold inside it is darker.AuthScene__note {b {- color: #111;+ color: var(--auth-scene-card-ink, #111);}}diff --git a/frontend/src/scenes/authentication/shared/authScene/AuthScene.tsx b/frontend/src/scenes/authentication/shared/authScene/AuthScene.tsxindex 82331b3e52d3..a44908276e0d 100644--- a/frontend/src/scenes/authentication/shared/authScene/AuthScene.tsx+++ b/frontend/src/scenes/authentication/shared/authScene/AuthScene.tsx@@ -4,16 +4,16 @@ import { useValues } from 'kea'import { type ReactNode } from 'react'import { Logo } from 'lib/brand'-import { cn } from 'lib/utils/css-classes'+import { OAuthConnectionLogos } from 'lib/components/OAuthConnectionLogos/OAuthConnectionLogos'import { pendingOAuthConnectionLogic } from '../pendingOAuthConnectionLogic'+import { AuthSceneBackdrop } from './AuthSceneBackdrop'import { DevLoginPanel } from './DevLoginPanel'-import { PendingOAuthConnectionLogos } from './PendingOAuthConnectionLogos'import { Typewriter } from './Typewriter'export function AuthScene({ notes, children }: { notes: string[]; children: ReactNode }): JSX.Element {return (- <div className={cn('AuthScene relative h-screen overflow-x-hidden overflow-y-auto font-sans text-primary')}>+ <AuthSceneBackdrop className="relative h-screen overflow-x-hidden overflow-y-auto"><div className="hidden sm:block"><Typewriter lines={notes} /></div>@@ -21,7 +21,7 @@ export function AuthScene({ notes, children }: { notes: string[]; children: Reac<div className="AuthScene__column flex flex-col items-center w-[27rem] max-w-full">{children}</div></div><DevLoginPanel />- </div>+ </AuthSceneBackdrop>)}@@ -42,10 +42,10 @@ export function AuthSceneCard({{top !== undefined ? (top) : pendingConnection ? (- <PendingOAuthConnectionLogos connection={pendingConnection} />+ <OAuthConnectionLogos appName={pendingConnection.clientName} logoUri={pendingConnection.logoUri} />) : (<span className="AuthScene__logo block mb-4">- <Logo variant="gradient" size="lg" />+ <Logo size="lg" /></span>)}<div className="AuthScene__card w-full pt-8 px-5 sm:px-9 pb-8">{children}</div>diff --git a/frontend/src/scenes/authentication/shared/authScene/AuthSceneBackdrop.tsx b/frontend/src/scenes/authentication/shared/authScene/AuthSceneBackdrop.tsxnew file mode 100644index 000000000000..4d0b40f588ea--- /dev/null+++ b/frontend/src/scenes/authentication/shared/authScene/AuthSceneBackdrop.tsx@@ -0,0 +1,14 @@+import './AuthScene.scss'++import { type ReactNode } from 'react'++import { cn } from 'lib/utils/css-classes'++/**+ * Carries the light-mode button tokens in AuthScene.scss as well as the backdrop, which is what+ * turns LemonButton's primary amber on these screens. Owns no layout, so a scene that manages its+ * own height and scrolling can share it with the ones that use {@link AuthScene}.+ */+export function AuthSceneBackdrop({ className, children }: { className?: string; children: ReactNode }): JSX.Element {+ return <div className={cn('AuthScene font-sans text-primary', className)}>{children}</div>+}diff --git a/frontend/src/scenes/oauth/OAuthAuthorize.stories.tsx b/frontend/src/scenes/oauth/OAuthAuthorize.stories.tsxindex 22e6b28250ac..d68a764274fd 100644--- a/frontend/src/scenes/oauth/OAuthAuthorize.stories.tsx+++ b/frontend/src/scenes/oauth/OAuthAuthorize.stories.tsx@@ -121,6 +121,16 @@ export const DefaultScopes: Story = {},}+// The logo is a third-party icon this repo already serves, so the snapshot never reaches out to a+// host we do not control.+export const WithApplicationLogo: Story = {+ decorators: [withOAuthApplication({ name: 'Zapier', logo_uri: '/static/services/zapier.png' })],+ render: () => {+ useDelayedOnMountEffect(() => pushAuthorize())+ return <App />+ },+}+// Explicit request where every requested scope is required: rows render as a plain locked// checkmark list (no access selectors) and the bulk actions are hidden, since there is nothing// to choose.diff --git a/frontend/src/scenes/oauth/OAuthAuthorize.tsx b/frontend/src/scenes/oauth/OAuthAuthorize.tsxindex fb43e1282719..50f0db8785f7 100644--- a/frontend/src/scenes/oauth/OAuthAuthorize.tsx+++ b/frontend/src/scenes/oauth/OAuthAuthorize.tsx@@ -1,4 +1,3 @@-import { decode } from 'he'import { useActions, useValues } from 'kea'import { Form } from 'kea-forms'import { useMemo, useState } from 'react'@@ -14,8 +13,10 @@ import { LemonLabel } from 'lib/lemon-ui/LemonLabel/LemonLabel'import { LemonSelect } from 'lib/lemon-ui/LemonSelect'import { LemonTag } from 'lib/lemon-ui/LemonTag'import { Link } from 'lib/lemon-ui/Link'+import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'import { Spinner } from 'lib/lemon-ui/Spinner'import { Tooltip } from 'lib/lemon-ui/Tooltip'+import { AuthCardTitle } from 'scenes/authentication/shared/authScene/AuthCardTitle'import { organizationLogic } from 'scenes/organizationLogic'import ScopeAccessSelector from 'scenes/settings/user/scopes/ScopeAccessSelector'@@ -23,11 +24,12 @@ import { impersonationNoticeLogic } from '~/layout/navigation/ImpersonationNoticimport { AvailableFeature } from '~/types'import { SceneExport } from '../sceneTypes'+import { OAuthAuthorizeLayout } from './OAuthAuthorizeLayout'import { ScopeAccessLevel, oauthAuthorizeLogic } from './oauthAuthorizeLogic'export const OAuthAuthorizeError = ({ title, description }: { title: string; description: string }): JSX.Element => {return (- <div className="flex flex-col items-center justify-center h-full gap-4 py-12">+ <div className="AuthScene__card flex flex-col items-center gap-4 p-8 text-center"><IconWarning className="text-muted-alt text-4xl" /><div className="text-xl font-semibold">{title}</div><div className="text-sm text-muted">{description}</div>@@ -37,7 +39,7 @@ export const OAuthAuthorizeError = ({ title, description }: { title: string; desexport const OAuthAuthorizeSuccess = ({ appName }: { appName: string }): JSX.Element => {return (- <div className="flex flex-col items-center justify-center h-full gap-4 py-12">+ <div className="AuthScene__card flex flex-col items-center gap-4 p-8"><IconCheckCircle className="text-success text-4xl" /><div className="text-xl font-semibold">Authorization successful</div><div className="text-sm text-muted text-center">@@ -56,7 +58,7 @@ export const OAuthAuthorizeRedirecting = ({redirectUrl: string}): JSX.Element => {return (- <div className="flex flex-col items-center justify-center h-full gap-4 py-12 px-4">+ <div className="AuthScene__card flex flex-col items-center gap-4 p-8"><Spinner className="text-3xl" /><div className="text-xl font-semibold">Redirecting to {appName}…</div><div className="text-sm text-muted text-center max-w-md">@@ -134,6 +136,7 @@ export const OAuthAuthorize = (): JSX.Element => {showReadOnlyBulkAction,oauthApplication,oauthApplicationLoading,+ appName,allOrganizations,filteredTeams,oauthAuthorization,@@ -213,331 +216,330 @@ export const OAuthAuthorize = (): JSX.Element => {if (oauthApplicationLoading) {return (- <div className="flex items-center justify-center h-full py-12">- <Spinner />- </div>+ <OAuthAuthorizeLayout>+ <div className="flex items-center justify-center py-12">+ <Spinner />+ </div>+ </OAuthAuthorizeLayout>)}if (!oauthApplication) {return (- <OAuthAuthorizeError- title="No application found"- description="The application requesting access to your data does not exist."- />+ <OAuthAuthorizeLayout>+ <OAuthAuthorizeError+ title="No application found"+ description="The application requesting access to your data does not exist."+ />+ </OAuthAuthorizeLayout>)}- // The name is HTML-escaped at ingestion (see posthog/api/oauth/client_name.py). Decode it- // back to plain text so React's own output-escaping renders it correctly instead of showing- // literal entities like "&".- const appName = decode(oauthApplication.name)-if (authorizationComplete) {- return <OAuthAuthorizeSuccess appName={appName} />+ return (+ <OAuthAuthorizeLayout>+ <OAuthAuthorizeSuccess appName={appName} />+ </OAuthAuthorizeLayout>+ )}if (isRedirecting) {- return <OAuthAuthorizeRedirecting appName={appName} redirectUrl={redirectUrl} />+ return (+ <OAuthAuthorizeLayout>+ <OAuthAuthorizeRedirecting appName={appName} redirectUrl={redirectUrl} />+ </OAuthAuthorizeLayout>+ )}return (- <div className="flex flex-col h-full max-h-full overflow-hidden py-6 px-4 sm:px-6">+ <OAuthAuthorizeLayout>+ <div className="shrink-0 mb-3">+ <AuthCardTitle+ title={+ <>+ <span>Authorize </span>+ <span>{appName}</span>+ </>+ }+ sub={`${appName} is requesting access to your data.`}+ className="mb-2"+ />+ {user && (+ <div className="flex items-center justify-center gap-1.5 min-w-0 text-sm text-muted">+ <ProfilePicture user={user} size="sm" className="shrink-0" />+ <span className="truncate">+ <span className="font-semibold text-primary">{user.email}</span>+ {[currentOrganization?.name ?? user.organization?.name, window.location.host]+ .filter(Boolean)+ .map((part) => ` · ${part}`)+ .join('')}+ </span>+ </div>+ )}+ </div>+{/* Nothing in the column grows: the card hugs a short permission list, and onlystretches to the window height when the list is longer than that. */}- <div className="flex flex-col min-h-0 w-full max-w-2xl mx-auto">- <div className="shrink-0 text-center mb-4">- {oauthApplication.logo_uri && (- <div className="w-16 h-16 mx-auto mb-3 rounded-full border border-border bg-bg-light p-3 flex items-center justify-center">- <img- src={oauthApplication.logo_uri}- alt={`${appName} logo`}- className="w-full h-full object-contain"- referrerPolicy="no-referrer"- onError={(e) => {- // Hide the image container if the logo fails to load- // (e.g. Cross-Origin-Resource-Policy: same-origin)- const container = (e.target as HTMLImageElement).parentElement- if (container) {- container.style.display = 'none'- }- }}- />- </div>- )}- <h2 className="text-xl sm:text-2xl font-semibold">- Authorize <strong>{appName}</strong>- </h2>- <p className="text-muted mt-2 text-sm sm:text-base">{appName} is requesting access to your data.</p>- </div>+ <Form logic={oauthAuthorizeLogic} formKey="oauthAuthorization" className="flex flex-col min-h-0">+ <div className="AuthScene__card flex flex-col min-h-0 overflow-hidden">+ {/* Everything the person reads and adjusts scrolls in here. The action row+ below sits outside, so Authorize stays reachable however many+ permissions the application asks for. */}+ <div className="flex flex-col min-h-0 overflow-y-auto" data-attr="oauth-permissions-scroll">+ <div className="flex flex-col gap-4 sm:gap-6 p-4 sm:p-6">+ {isImpersonated && (+ <div className="flex items-center gap-2 p-3 bg-danger-highlight border border-danger rounded text-sm">+ <IconWarning className="text-warning shrink-0" />+ <span>+ <strong>You are impersonating someone.</strong> Any OAuth tokens authorized in+ this session are short-lived and will be revoked when impersonation ends+ {isImpersonationReadOnly+ ? ', and write scopes will be downgraded to read-only'+ : ''}+ .+ </span>+ </div>+ )}- <Form logic={oauthAuthorizeLogic} formKey="oauthAuthorization" className="flex flex-col min-h-0">- <div className="flex flex-col min-h-0 bg-bg-light border border-border rounded shadow overflow-hidden">- {/* Everything the person reads and adjusts scrolls in here. The action row- below sits outside, so Authorize stays reachable however many- permissions the application asks for. */}- <div className="flex flex-col min-h-0 overflow-y-auto" data-attr="oauth-permissions-scroll">- <div className="flex flex-col gap-4 sm:gap-6 p-4 sm:p-6">- {isImpersonated && (- <div className="flex items-center gap-2 p-3 bg-danger-highlight border border-danger rounded text-sm">- <IconWarning className="text-warning shrink-0" />- <span>- <strong>You are impersonating someone.</strong> Any OAuth tokens authorized- in this session are short-lived and will be revoked when impersonation ends- {isImpersonationReadOnly- ? ', and write scopes will be downgraded to read-only'- : ''}- .- </span>- </div>- )}+ {!oauthApplication.is_verified && (+ <div className="flex items-center gap-2 p-3 bg-warning-highlight border border-warning rounded text-sm">+ <IconWarning className="text-warning shrink-0" />+ <span>+ <strong>Unverified application.</strong> This application has not been verified+ by PostHog. Only continue if you recognize and trust this application.+ </span>+ </div>+ )}- {!oauthApplication.is_verified && (- <div className="flex items-center gap-2 p-3 bg-warning-highlight border border-warning rounded text-sm">- <IconWarning className="text-warning shrink-0" />- <span>- <strong>Unverified application.</strong> This application has not been- verified by PostHog. Only continue if you recognize and trust this- application.- </span>- </div>- )}+ {scopesWereDefaulted && isMcpResource && (+ <LemonBanner type="info">+ <strong>No permissions requested.</strong> This application didn't request specific+ permissions. Showing all permissions the PostHog MCP server supports.+ </LemonBanner>+ )}- {scopesWereDefaulted && isMcpResource && (- <LemonBanner type="info">- <strong>No permissions requested.</strong> This application didn't request- specific permissions. Showing all permissions the PostHog MCP server supports.- </LemonBanner>- )}+ {requiredAccessLevel === 'team' ? (+ <>+ <div className="flex flex-col gap-2">+ <LemonLabel>Organization</LemonLabel>+ <LemonSelect+ fullWidth+ placeholder="Select organization"+ options={orgOptions}+ value={selectedOrganization}+ onChange={(val) => {+ if (val) {+ setSelectedOrganization(val)+ }+ }}+ />+ </div>- {requiredAccessLevel === 'team' ? (- <>- <div className="flex flex-col gap-2">- <LemonLabel>Organization</LemonLabel>- <LemonSelect- fullWidth- placeholder="Select organization"- options={orgOptions}- value={selectedOrganization}- onChange={(val) => {- if (val) {- setSelectedOrganization(val)- }- }}+ <div className="flex flex-col gap-2">+ <LemonLabel>Project</LemonLabel>+ {showCreateProject ? (+ <InlineCreateForm+ label="New project name"+ placeholder="e.g. My App"+ loading={newProjectLoading}+ onSubmit={createNewProject}+ onCancel={() => setShowCreateProject(false)}/>- </div>-- <div className="flex flex-col gap-2">- <LemonLabel>Project</LemonLabel>- {showCreateProject ? (- <InlineCreateForm- label="New project name"- placeholder="e.g. My App"- loading={newProjectLoading}- onSubmit={createNewProject}- onCancel={() => setShowCreateProject(false)}- />- ) : (- <div className="flex items-center gap-2">- <div className="flex-1 min-w-0">- <LemonSelect- fullWidth- placeholder={- selectedOrganization- ? 'Select project'- : 'Select an organization first'- }- options={projectOptions}- value={oauthAuthorization.scoped_teams[0] ?? null}- onChange={(val) => {- if (val) {- setOauthAuthorizationValue('scoped_teams', [val])- }- }}- disabledReason={- !selectedOrganization- ? 'Select an organization first'- : undefined+ ) : (+ <div className="flex items-center gap-2">+ <div className="flex-1 min-w-0">+ <LemonSelect+ fullWidth+ placeholder={+ selectedOrganization+ ? 'Select project'+ : 'Select an organization first'+ }+ options={projectOptions}+ value={oauthAuthorization.scoped_teams[0] ?? null}+ onChange={(val) => {+ if (val) {+ setOauthAuthorizationValue('scoped_teams', [val])}- />- </div>- <LemonButton- className="shrink-0"- type="secondary"- size="small"- icon={<IconPlus />}+ }}disabledReason={!selectedOrganization? 'Select an organization first'- : (projectCreationForbiddenReason ?? undefined)+ : undefined}- onClick={handleShowCreateProject}/></div>- )}- </div>- </>- ) : (- <ScopeAccessSelector- accessType={oauthAuthorization.access_type}- organizations={allOrganizations}- teams={filteredTeams ?? undefined}- requiredAccessLevel={requiredAccessLevel}- autoSelectFirst={true}- />- )}- </div>-- <div className="flex flex-col">- {/* Sticky and full-bleed, so the bulk actions stay in reach once the- first rows scroll away. z-10 clears the access selectors, whose- own parts sit at z-index 2. */}- <div className="sticky top-0 z-10 flex items-center justify-between gap-2 flex-wrap px-4 sm:px-6 py-2 bg-bg-light border-y border-border">- <div className="text-sm font-semibold uppercase text-muted">Permissions</div>- {adjustableScopeRows.length > 1 && (- <div className="flex items-center gap-1 flex-wrap">- <LemonButton- size="xsmall"- type="secondary"- onClick={() => setAllScopeAccess('write')}- >- Select all- </LemonButton>- {showReadOnlyBulkAction && (<LemonButton- size="xsmall"+ className="shrink-0"type="secondary"- onClick={() => setAllScopeAccess('read')}- >- Read-only- </LemonButton>- )}+ size="small"+ icon={<IconPlus />}+ disabledReason={+ !selectedOrganization+ ? 'Select an organization first'+ : (projectCreationForbiddenReason ?? undefined)+ }+ onClick={handleShowCreateProject}+ />+ </div>+ )}+ </div>+ </>+ ) : (+ <ScopeAccessSelector+ accessType={oauthAuthorization.access_type}+ organizations={allOrganizations}+ teams={filteredTeams ?? undefined}+ requiredAccessLevel={requiredAccessLevel}+ autoSelectFirst={true}+ />+ )}+ </div>++ <div className="flex flex-col">+ {/* Sticky and full-bleed, so the bulk actions stay in reach once the+ first rows scroll away. z-10 clears the access selectors, whose+ own parts sit at z-index 2. */}+ <div className="AuthScene__cardSurface sticky top-0 z-10 flex items-center justify-between gap-2 flex-wrap px-4 sm:px-6 py-2 border-y border-border">+ <div className="text-sm font-semibold uppercase text-muted">Permissions</div>+ {adjustableScopeRows.length > 1 && (+ <div className="flex items-center gap-1 flex-wrap">+ <LemonButton+ size="xsmall"+ type="secondary"+ onClick={() => setAllScopeAccess('write')}+ >+ Select all+ </LemonButton>+ {showReadOnlyBulkAction && (<LemonButtonsize="xsmall"type="secondary"- onClick={() => setAllScopeAccess('none')}+ onClick={() => setAllScopeAccess('read')}>- Deselect all+ Read-only</LemonButton>- </div>- )}- </div>- <div className="flex flex-col gap-3 px-4 sm:px-6 py-4">- {(identityScopeDescriptions.length > 0 || requiredScopeRows.length > 0) && (- <ul className="space-y-2">- {identityScopeDescriptions.map((description, idx) => (- <li key={idx} className="flex items-center space-x-2">- <IconCheck color="var(--success)" className="shrink-0" />- <span className="font-medium">{description}</span>- </li>- ))}- {requiredScopeRows.map((row) => (- <li key={row.key} className="flex items-center space-x-2">- <IconCheck color="var(--success)" className="shrink-0" />- <span className="font-medium">{row.description}</span>- {!allScopesRequired && (- <Tooltip title={`${appName} requires this permission`}>- <LemonTag>Required</LemonTag>- </Tooltip>- )}- </li>- ))}- </ul>- )}- {adjustableScopeRows.length > 0 && (- <div className="flex flex-col">- {adjustableScopeRows.map((row) => (- <ScopeAccessRow- key={row.key}- label={row.label}- info={row.info}- muted={row.value === 'none'}- value={row.value}- onChange={(value) =>- setScopeAccess(row.key, value as ScopeAccessLevel)- }- noneDisabledReason={- row.minLevel !== 'none'- ? `${appName} requires at least ${row.minLevel} access`- : undefined- }- writeDisabledReason={- row.maxLevel !== 'write'- ? `Not requested by ${appName}`- : undefined- }- warning={row.warning}- />- ))}- </div>- )}- {accessControlsApply && (- <LemonBanner type="info" icon={<IconLock className="LemonBanner__icon" />}>- <strong className="block">Access controls still apply.</strong>- {appName} can only do what both your access level and these permissions- allow.- </LemonBanner>- )}- </div>+ )}+ <LemonButton+ size="xsmall"+ type="secondary"+ onClick={() => setAllScopeAccess('none')}+ >+ Deselect all+ </LemonButton>+ </div>+ )}+ </div>+ <div className="flex flex-col gap-3 px-4 sm:px-6 py-4">+ {(identityScopeDescriptions.length > 0 || requiredScopeRows.length > 0) && (+ <ul className="space-y-2">+ {identityScopeDescriptions.map((description, idx) => (+ <li key={idx} className="flex items-center space-x-2">+ <IconCheck color="var(--success)" className="shrink-0" />+ <span className="font-medium">{description}</span>+ </li>+ ))}+ {requiredScopeRows.map((row) => (+ <li key={row.key} className="flex items-center space-x-2">+ <IconCheck color="var(--success)" className="shrink-0" />+ <span className="font-medium">{row.description}</span>+ {!allScopesRequired && (+ <Tooltip title={`${appName} requires this permission`}>+ <LemonTag>Required</LemonTag>+ </Tooltip>+ )}+ </li>+ ))}+ </ul>+ )}+ {adjustableScopeRows.length > 0 && (+ <div className="flex flex-col">+ {adjustableScopeRows.map((row) => (+ <ScopeAccessRow+ key={row.key}+ label={row.label}+ info={row.info}+ muted={row.value === 'none'}+ value={row.value}+ onChange={(value) => setScopeAccess(row.key, value as ScopeAccessLevel)}+ noneDisabledReason={+ row.minLevel !== 'none'+ ? `${appName} requires at least ${row.minLevel} access`+ : undefined+ }+ writeDisabledReason={+ row.maxLevel !== 'write' ? `Not requested by ${appName}` : undefined+ }+ warning={row.warning}+ />+ ))}+ </div>+ )}+ {accessControlsApply && (+ <LemonBanner type="info" icon={<IconLock className="LemonBanner__icon" />}>+ <strong className="block">Access controls still apply.</strong>+ {appName} can only do what both your access level and these permissions allow.+ </LemonBanner>+ )}</div></div>+ </div>- <div className="shrink-0 flex flex-col gap-3 px-4 sm:px-6 py-4 border-t border-border">- {redirectDomain && (- <div className="text-xs text-muted">- <p>- Once you authorize, you will be redirected to <strong>{redirectDomain}</strong>- </p>- <p>- The developer of {appName}'s privacy policy and terms of service apply to this- application- </p>- </div>- )}-- <div className="flex flex-col-reverse sm:flex-row sm:justify-end gap-2">- <LemonButton- type="tertiary"- status="alt"- htmlType="button"- data-attr="oauth-authorize-cancel"- loading={isCanceling}- disabledReason={- isCanceling- ? 'Canceling...'- : isOauthAuthorizationSubmitting- ? 'Processing...'- : undefined- }- onClick={(e) => {- e.preventDefault()- cancel()- }}- >- Cancel- </LemonButton>- <LemonButton- type="primary"- htmlType="submit"- data-attr="oauth-authorize-submit"- loading={isOauthAuthorizationSubmitting}- disabledReason={- isOauthAuthorizationSubmitting- ? 'Authorizing...'- : isCanceling- ? 'Processing...'- : undefined- }- onClick={() => submitOauthAuthorization()}- >- Authorize {appName}- </LemonButton>+ <div className="shrink-0 flex flex-col gap-3 px-4 sm:px-6 py-4 border-t border-border">+ {redirectDomain && (+ <div className="text-xs text-muted">+ <p>+ Once you authorize, you will be redirected to <strong>{redirectDomain}</strong>+ </p>+ <p>+ The developer of {appName}'s privacy policy and terms of service apply to this+ application+ </p></div>+ )}++ <div className="flex flex-col-reverse sm:flex-row sm:justify-end gap-2">+ <LemonButton+ type="tertiary"+ status="alt"+ htmlType="button"+ data-attr="oauth-authorize-cancel"+ loading={isCanceling}+ disabledReason={+ isCanceling+ ? 'Canceling...'+ : isOauthAuthorizationSubmitting+ ? 'Processing...'+ : undefined+ }+ onClick={(e) => {+ e.preventDefault()+ cancel()+ }}+ >+ Cancel+ </LemonButton>+ <LemonButton+ type="primary"+ htmlType="submit"+ data-attr="oauth-authorize-submit"+ loading={isOauthAuthorizationSubmitting}+ disabledReason={+ isOauthAuthorizationSubmitting+ ? 'Authorizing...'+ : isCanceling+ ? 'Processing...'+ : undefined+ }+ onClick={() => submitOauthAuthorization()}+ >+ Authorize {appName}+ </LemonButton></div></div>- </Form>- </div>- </div>+ </div>+ </Form>+ </OAuthAuthorizeLayout>)}diff --git a/frontend/src/scenes/oauth/OAuthAuthorizeLayout.tsx b/frontend/src/scenes/oauth/OAuthAuthorizeLayout.tsxnew file mode 100644index 000000000000..94de80e499e8--- /dev/null+++ b/frontend/src/scenes/oauth/OAuthAuthorizeLayout.tsx@@ -0,0 +1,32 @@+import { useValues } from 'kea'+import { type ReactNode } from 'react'++import { Logo } from 'lib/brand'+import { OAuthConnectionLogos } from 'lib/components/OAuthConnectionLogos/OAuthConnectionLogos'+import { AuthSceneBackdrop } from 'scenes/authentication/shared/authScene/AuthSceneBackdrop'++import { oauthAuthorizeLogic } from './oauthAuthorizeLogic'++/**+ * Does not use `AuthScene`, because that scrolls the page. The consent card scrolls its own+ * permission list instead, so that the action row stays in view however many permissions an+ * application asks for.+ */+export function OAuthAuthorizeLayout({ children }: { children: ReactNode }): JSX.Element {+ const { oauthApplication, appName } = useValues(oauthAuthorizeLogic)++ return (+ <AuthSceneBackdrop className="flex flex-col h-full max-h-full overflow-hidden py-4 px-4 sm:px-6">+ <div className="flex flex-col min-h-0 w-full max-w-2xl mx-auto">+ {oauthApplication ? (+ <OAuthConnectionLogos appName={appName} logoUri={oauthApplication.logo_uri ?? null} />+ ) : (+ <span className="AuthScene__logo shrink-0 block mx-auto mb-4">+ <Logo size="lg" />+ </span>+ )}+ {children}+ </div>+ </AuthSceneBackdrop>+ )+}diff --git a/frontend/src/scenes/oauth/oauthAuthorizeLogic.ts b/frontend/src/scenes/oauth/oauthAuthorizeLogic.tsindex b56b4f93b8e6..390b3de9e7a6 100644--- a/frontend/src/scenes/oauth/oauthAuthorizeLogic.ts+++ b/frontend/src/scenes/oauth/oauthAuthorizeLogic.ts@@ -1,3 +1,4 @@+import { decode } from 'he'import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'import { forms } from 'kea-forms'import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'@@ -196,6 +197,7 @@ export interface oauthAuthorizeLogicValues {allScopesRequired: booleanallTeams: TeamBasicType[] | nullallTeamsLoading: boolean+ appName: stringauthorizationComplete: booleanconsentResourceScopes: string[]effectiveScopes: string[]@@ -361,6 +363,7 @@ export interface oauthAuthorizeLogicActions {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface oauthAuthorizeLogicMeta {__keaTypeGenInternalSelectorTypes: {+ appName: (oauthApplication: OAuthApplicationPublicMetadata | null) => stringallOrganizations: (user: UserType | null) => OrganizationBasicType[]sortedTeams: (allTeams: TeamBasicType[] | null,@@ -708,6 +711,14 @@ export const oauthAuthorizeLogic = kea<oauthAuthorizeLogicType>([selectors(() => ({// The server sets this flag once for the page, so no action changes it.accessControlsApply: [() => [], (): boolean => getAppContext()?.oauth_consent_access_controls_apply === true],+ appName: [+ (s) => [s.oauthApplication],+ // The name is HTML-escaped at ingestion (see posthog/api/oauth/client_name.py). Decode+ // it back to plain text so React's own output escaping renders it correctly instead of+ // showing literal entities like "&".+ (oauthApplication: OAuthApplicationPublicMetadata | null): string =>+ oauthApplication ? decode(oauthApplication.name) : '',+ ],allOrganizations: [(s) => [s.user],(user: UserType): OrganizationBasicType[] => {diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 21dc0557d75a..1c7854aafbfd 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -5500,6 +5500,9 @@ importers:'@cloudflare/workers-types':specifier: ^4.20260120.0version: 4.20260207.0+ '@posthog/brand':+ specifier: 'catalog:'+ version: 0.11.0([email protected])typescript:specifier: 6.0.3version: 6.0.3diff --git a/posthog/middleware.py b/posthog/middleware.pyindex f1656b538faf..e7252c40ab32 100644--- a/posthog/middleware.py+++ b/posthog/middleware.py@@ -120,6 +120,25 @@ default_cookie_options = {cookie_api_paths_to_ignore = {"api", "flags", "scim"}+# Both regions share the `posthog.com` domain, so a browser signed in to both carries both of+# these, which is what lets the OAuth region picker tell one live region apart from two. The+# `ph_*` cookies above cannot: they are one slot, last writer wins.+REGION_AUTHENTICATED_COOKIES = {"US": "ph_authenticated_us", "EU": "ph_authenticated_eu"}+++def region_authenticated_cookie_name() -> str | None:+ return REGION_AUTHENTICATED_COOKIES.get((settings.CLOUD_DEPLOYMENT or "").upper())+++def session_age_for_user(user: User) -> int:+ org_id = user.current_organization_id+ if org_id:+ org_session_age = cache.get(f"org_session_age:{org_id}")+ if org_session_age is not None:+ return org_session_age+ return settings.SESSION_COOKIE_AGE++MANAGED_PROXY_SIGNATURE_MAX_AGE_SECONDS = 60MANAGED_PROXY_SIGNATURE_MAX_CLOCK_SKEW_SECONDS = 5@@ -917,6 +936,11 @@ class PostHogTokenCookieMiddleware(MiddlewareMixin):# clears the cookies that were previously set, except for ph_current_instance as that is used for the website login buttonresponse.delete_cookie("ph_current_project_token", domain=default_cookie_options["domain"])response.delete_cookie("ph_current_project_name", domain=default_cookie_options["domain"])+ # Unlike the two above, leaving this one behind would redirect the picker into a+ # region the visitor just left.+ region_cookie = region_authenticated_cookie_name()+ if region_cookie:+ response.delete_cookie(region_cookie, domain=default_cookie_options["domain"])if request.user and request.user.is_authenticated:if request.user.team:# nosemgrep: python.django.security.audit.secure-cookies.django-secure-set-cookie (httponly=False intentional, read by JS)@@ -955,6 +979,30 @@ class PostHogTokenCookieMiddleware(MiddlewareMixin):samesite=default_cookie_options["samesite"],)+ region_cookie = region_authenticated_cookie_name()+ session_created_at = request.session.get(settings.SESSION_COOKIE_CREATED_AT_KEY)+ if region_cookie and session_created_at:+ # SessionAgeMiddleware ages a session from creation and never slides that+ # deadline, so count down to the same instant rather than renew a window here.+ remaining = int(session_created_at + session_age_for_user(request.user) - time.time())+ if remaining > 0:+ response.set_cookie(+ key=region_cookie,+ value="1",+ max_age=remaining,+ expires=None,+ path=default_cookie_options["path"],+ domain=default_cookie_options["domain"],+ secure=default_cookie_options["secure"],+ # The oauth.posthog.com worker reads this from the request Cookie header,+ # so nothing in the browser needs it. HttpOnly keeps a script on any+ # sibling posthog.com origin from reading or overwriting it.+ httponly=True,+ # Strict, used above, is withheld on the cross-site top-level navigation+ # an OAuth client sends the visitor to oauth.posthog.com by.+ samesite="Lax",+ )+auth_backend = request.session.get("_auth_user_backend")login_method = AUTH_BACKEND_KEYS.get(auth_backend)if login_method:@@ -996,14 +1044,7 @@ class SessionAgeMiddleware:# Get session creation timesession_created_at = request.session.get(settings.SESSION_COOKIE_CREATED_AT_KEY)if session_created_at:- # Get timeout from Redis cache first, fallback to settings- org_id = request.user.current_organization_id- session_age = None- if org_id:- session_age = cache.get(f"org_session_age:{org_id}")-- if session_age is None:- session_age = settings.SESSION_COOKIE_AGE+ session_age = session_age_for_user(request.user)current_time = time.time()if current_time - session_created_at > session_age:diff --git a/posthog/test/test_middleware.py b/posthog/test/test_middleware.pyindex ddf945db50db..b0ddd4feb1a4 100644--- a/posthog/test/test_middleware.py+++ b/posthog/test/test_middleware.py@@ -693,6 +693,17 @@ class TestPostHogTokenCookieMiddleware(APIBaseTest):self.assertEqual(ph_instance_cookie["secure"], True)self.assertEqual(ph_instance_cookie["max-age"], 31536000)+ ph_authenticated_cookie = response.cookies["ph_authenticated_us"]+ self.assertEqual(ph_authenticated_cookie.value, "1")+ self.assertEqual(ph_authenticated_cookie["path"], "/")+ self.assertEqual(ph_authenticated_cookie["samesite"], "Lax")+ self.assertEqual(ph_authenticated_cookie["httponly"], True)+ self.assertEqual(ph_authenticated_cookie["domain"], "posthog.com")+ self.assertEqual(ph_authenticated_cookie["secure"], True)+ self.assertNotIn("ph_authenticated_eu", response.cookies)+ self.assertLessEqual(ph_authenticated_cookie["max-age"], settings.SESSION_COOKIE_AGE)+ self.assertGreater(ph_authenticated_cookie["max-age"], settings.SESSION_COOKIE_AGE - 60)+ph_last_login_method_cookie = response.cookies["ph_last_login_method"]self.assertEqual(ph_last_login_method_cookie.key, "ph_last_login_method")self.assertEqual(ph_last_login_method_cookie.value, "password")@@ -732,6 +743,8 @@ class TestPostHogTokenCookieMiddleware(APIBaseTest):self.assertTrue(response.cookies["ph_current_project_name"]["expires"] == "Thu, 01 Jan 1970 00:00:00 GMT")# We don't want to remove the ph_current_instance cookieself.assertNotIn("ph_current_instance", response.cookies)+ # ...but the region cookie has to go, or the OAuth picker redirects into a signed-out region+ self.assertEqual(response.cookies["ph_authenticated_us"]["expires"], "Thu, 01 Jan 1970 00:00:00 GMT")# Request a page after logging outresponse = self.client.get("/")diff --git a/services/oauth-proxy/README.md b/services/oauth-proxy/README.mdindex 0ecf434224d9..2ea33409d66a 100644--- a/services/oauth-proxy/README.md+++ b/services/oauth-proxy/README.md@@ -24,6 +24,7 @@ The one exception is the OpenID Connect ID token: the worker verifies the region| `POST` | `/oauth/revoke` | Routed by `client_id`, falls back to trying both regions || `POST` | `/oauth/introspect` | US first, then EU (a 200 with `active: false` counts as a miss) || `GET` | `/oauth/userinfo` | Tries both regions with the bearer token |+| `GET` | `/static/fonts/*.woff2` | RoundHog faces for the region picker, bundled from `@posthog/brand` |Trailing slashes are optional; paths are normalized before matching.@@ -34,10 +35,18 @@ Trailing slashes are optional; paths are normalized before matching.The US `client_id` is handed back as the proxy `client_id`.The proxy's own `/oauth/callback/` is appended to the submitted `redirect_uris` so both regional servers accept it later.2. **Authorize.**- `/oauth/authorize` serves a static region picker.+ `/oauth/authorize` resolves the region, by cookie when it can and by asking when it cannot.+ Each region sets `ph_authenticated_us` or `ph_authenticated_eu` on the shared `posthog.com` domain while a session is live there, and clears it on logout.+ Exactly one of them means the answer is unambiguous, so the worker redirects without rendering anything.+ Both or neither is genuinely ambiguous, so it serves the static region picker instead, marking the region `ph_current_instance` names as last used.+ The page mirrors the app's login scene (`frontend/src/scenes/authentication/shared/authScene`): the same background, card, logo and buttons, restated in plain CSS because a Worker cannot import the app's tokens.+ It loads no third-party asset; the RoundHog faces it uses are bundled from `@posthog/brand` and served by this worker (see `src/handlers/fonts.ts`).The picker re-requests the same URL with `_region=us|eu` appended.++ Those two cookies are `HttpOnly` and `SameSite=Lax`. Nothing in the browser reads them, because the worker takes them from the request Cookie header, so `HttpOnly` keeps a script on any sibling `posthog.com` origin from reading or overwriting them. A browser withholds a `Strict` cookie on the cross-site top-level navigation an OAuth client arrives by, so `ph_current_instance` and the other `Strict` cookies never reach this worker. Only page JavaScript can read them.The worker stores the region choice in KV under the `client_id`, swaps in the regional `client_id`, replaces `redirect_uri` with the proxy callback, and redirects to the region.For clients with a stored `redirect_uris` list, it also generates a nonce, stores the client's original `redirect_uri` and `state` under it, and sends the regional server that nonce as `state` instead of the client's own.+3. **Callback.**The regional server sends the user to `/oauth/callback` with the nonce from step 2 as `state`.The worker looks up and deletes the matching record, then forwards every query param to the client's original `redirect_uri`, restoring the client's own `state`.diff --git a/services/oauth-proxy/package.json b/services/oauth-proxy/package.jsonindex 4cef72433000..dec75dfff581 100644--- a/services/oauth-proxy/package.json+++ b/services/oauth-proxy/package.json@@ -24,6 +24,7 @@},"devDependencies": {"@cloudflare/workers-types": "^4.20260120.0",+ "@posthog/brand": "catalog:","typescript": "catalog:","vite-tsconfig-paths": "^5.1.4","vitest": "^4.1.0",diff --git a/services/oauth-proxy/src/handlers/authorize.ts b/services/oauth-proxy/src/handlers/authorize.tsindex 49d9d567b5b0..ec4945467e89 100644--- a/services/oauth-proxy/src/handlers/authorize.ts+++ b/services/oauth-proxy/src/handlers/authorize.ts@@ -54,10 +54,29 @@ export async function handleAuthorize(request: Request, kv: KVNamespace): Promisreturn redirectToRegionalAuthorize(url, selectedRegion, kv)}+ const liveRegion = soleLiveRegion(request.headers.get('Cookie'))+ if (liveRegion) {+ return redirectToRegionalAuthorize(url, liveRegion, kv)+ }+// Show the region picker page (JS reads query params from window.location.search)return new Response(REGION_PICKER_HTML, { headers: REGION_PICKER_HEADERS })}+/**+ * Reads `SameSite=Lax` cookies, which is the only kind that survives the cross-site top-level+ * navigation an OAuth client sends the visitor here with. `ph_current_instance` and the other+ * `Strict` cookies are withheld on that hop and never reach this code.+ */+function soleLiveRegion(cookieHeader: string | null): Region | null {+ if (!cookieHeader) {+ return null+ }+ const names = new Set(cookieHeader.split(';').map((c) => c.trim().split('=')[0]))+ const [sole, second] = (['us', 'eu'] as const).filter((region) => names.has(`ph_authenticated_${region}`))+ return sole && !second ? sole : null+}+async function redirectToRegionalAuthorize(url: URL, region: Region, kv: KVNamespace): Promise<Response> {const clientId = url.searchParams.get('client_id')const state = url.searchParams.get('state')diff --git a/services/oauth-proxy/src/handlers/fonts.ts b/services/oauth-proxy/src/handlers/fonts.tsnew file mode 100644index 000000000000..7f926ae5bd3f--- /dev/null+++ b/services/oauth-proxy/src/handlers/fonts.ts@@ -0,0 +1,30 @@+import ROUNDHOG_MEDIUM from '@posthog/brand/fonts/RoundHog-Medium.woff2'+import ROUNDHOG_SEMIBOLD from '@posthog/brand/fonts/RoundHog-SemiBold.woff2'+import ROUNDHOG_REGULAR from '@posthog/brand/fonts/RoundHog.woff2'++// Bundled into the Worker and served from this origin, so the authentication path depends on no+// third-party font host. Only the weights the picker uses are here: 400 body, 500 buttons, 700+// headings.+const FONTS: Record<string, ArrayBuffer> = {+ '/static/fonts/RoundHog.woff2': ROUNDHOG_REGULAR,+ '/static/fonts/RoundHog-Medium.woff2': ROUNDHOG_MEDIUM,+ '/static/fonts/RoundHog-SemiBold.woff2': ROUNDHOG_SEMIBOLD,+}++export const FONT_PATHS = Object.keys(FONTS)++export function handleFont(request: Request): Response {+ const font = FONTS[new URL(request.url).pathname.replace(/\/$/, '')]+ if (!font) {+ return new Response('Not found', { status: 404 })+ }+ return new Response(font, {+ headers: {+ 'Content-Type': 'font/woff2',+ // A face only changes when @posthog/brand ships a new one, which needs a redeploy.+ // A week of caching keeps the picker cheap without pinning a stale face forever.+ 'Cache-Control': 'public, max-age=604800, stale-while-revalidate=604800',+ 'X-Content-Type-Options': 'nosniff',+ },+ })+}diff --git a/services/oauth-proxy/src/index.ts b/services/oauth-proxy/src/index.tsindex eeed9198f835..146252ab8eb0 100644--- a/services/oauth-proxy/src/index.ts+++ b/services/oauth-proxy/src/index.ts@@ -9,6 +9,7 @@*/import { handleAuthorize } from '@/handlers/authorize'import { handleCallback } from '@/handlers/callback'+import { FONT_PATHS, handleFont } from '@/handlers/fonts'import { handleClientManifest, handleMetadata, handleOpenIdConfiguration } from '@/handlers/metadata'import { handleIntrospect, handleJwks, handleRevoke, handleUserInfo } from '@/handlers/passthrough'import { handleRegister } from '@/handlers/register'@@ -97,6 +98,10 @@ const routes: Route[] = [paths: ['/oauth/userinfo'],handler: handleUserInfo,},+ {+ paths: FONT_PATHS,+ handler: handleFont,+ },]export default {diff --git a/services/oauth-proxy/src/static/region-picker.html b/services/oauth-proxy/src/static/region-picker.htmlindex b51e8fc2a842..2d303354ceff 100644--- a/services/oauth-proxy/src/static/region-picker.html+++ b/services/oauth-proxy/src/static/region-picker.html@@ -6,24 +6,59 @@<meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="robots" content="noindex, nofollow"><title>Authenticate with PostHog</title>- <link rel="preconnect" href="https://fonts.googleapis.com">- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">+ <link rel="preload" href="/static/fonts/RoundHog.woff2" as="font" type="font/woff2" crossorigin>+ <link rel="preload" href="/static/fonts/RoundHog-Medium.woff2" as="font" type="font/woff2" crossorigin>+ <link rel="preload" href="/static/fonts/RoundHog-SemiBold.woff2" as="font" type="font/woff2" crossorigin><style>+ /* RoundHog is the app's UI font. The faces are served by this worker from+ @posthog/brand, so the page needs no third-party font host. Weight mapping follows+ the app: Regular 400, Medium 500, SemiBold 700. */+ @font-face {+ font-family: RoundHog;+ font-style: normal;+ font-weight: 400;+ font-display: swap;+ src: url('/static/fonts/RoundHog.woff2') format('woff2');+ }++ @font-face {+ font-family: RoundHog;+ font-style: normal;+ font-weight: 500;+ font-display: swap;+ src: url('/static/fonts/RoundHog-Medium.woff2') format('woff2');+ }++ @font-face {+ font-family: RoundHog;+ font-style: normal;+ font-weight: 700;+ font-display: swap;+ src: url('/static/fonts/RoundHog-SemiBold.woff2') format('woff2');+ }++ /* Values mirror the login scene (frontend/src/scenes/authentication/shared/authScene).+ This page is served by a Cloudflare Worker, so it cannot import the app's tokens. */:root {- --brand-blue: #1d4aff;- --brand-yellow: #f9bd2b;- --brand-orange: #f54e00;+ --font-sans:+ RoundHog, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', helvetica, arial,+ sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';+ --font-mono: ui-monospace, 'SFMono-Regular', 'SF Mono', 'Menlo', 'Consolas', 'Liberation Mono', monospace;--text-primary: #111;- --text-secondary: #5e5e5e;- --bg: #f3f0ec;- --bg-card: #fff;- --border: #e2dfda;+ --text-secondary: #4b5563;+ --text-footer: #404040;+ --card-bg: #f6f5f0;+ --card-border: #e3e0d4;+ --control-bg: #fff;+ --control-border: #ccc;+ --control-border-hover: #aaa;+ --control-frame: #e1dddd;+ --accent: #f7a501;+ --accent-blue: #3280ff;+ --accent-border: #b17816;+ --accent-border-hover: #8e5b03;--radius: 6px;- --button-border: #b17816;- --button-border-hover: #8e5b03;- --button-frame: #eb9d2a;}* {@@ -33,136 +68,205 @@}body {- font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;- background: var(--bg);- color: var(--text-primary);- min-height: 100vh;display: flex;- align-items: center;+ flex-direction: column;justify-content: center;- padding: 24px;+ min-height: 100vh;+ padding: 72px 16px;+ font-family: var(--font-sans);+ color: var(--text-primary);+ background-color: #b5cd8f;+ background-image:+ radial-gradient(80% 70% at 50% 30%, rgb(255 253 240 / 45%), transparent 70%),+ linear-gradient(180deg, #cfe0ae 0%, #b5cd8f 55%, #9dbb78 100%);+ background-repeat: no-repeat;+ background-attachment: fixed;-webkit-font-smoothing: antialiased;}- main {- max-width: 520px;- width: 100%;+ /* Mono notes in the corner of the garden, the same decoration the login scene types out. */+ #notes {+ position: absolute;+ top: clamp(20px, 4vh, 40px);+ left: clamp(20px, 4vw, 44px);+ min-height: 2.6em;+ font-family: var(--font-mono);+ font-size: 12px;+ line-height: 19.5px;+ color: rgb(45 74 22 / 65%);}- main>article {- border: 1px solid var(--border);- border-radius: var(--radius);- overflow: hidden;- background: var(--bg-card);- padding: 48px 40px;- text-align: center;+ #notes div {+ white-space: pre;}- header {- display: inline-flex;- align-items: center;- gap: 10px;- margin-bottom: 28px;+ #notes div:first-child {+ font-weight: 600;}- header svg {- height: 28px;- width: auto;+ #caret {+ display: inline-block;+ width: 8px;+ height: 1.05em;+ margin-left: 2px;+ vertical-align: -2px;+ background: var(--accent);+ border-radius: 1px;+ animation: blink 1.05s steps(1) infinite;}- .logo-fill-blue {- fill: var(--brand-blue);+ @media (max-width: 575px) {+ #notes {+ display: none;+ }}- .logo-fill-yellow {- fill: var(--brand-yellow);+ main {+ display: flex;+ flex-direction: column;+ align-items: center;+ width: 27rem;+ max-width: 100%;+ margin: 0 auto;}- .logo-fill-orange {- fill: var(--brand-orange);+ #logo {+ display: block;+ width: auto;+ height: 28px;+ margin-bottom: 16px;}- .logo-fill-text {- fill: var(--text-primary);+ @media (min-width: 576px) {+ #logo {+ height: 40px;+ }+ }++ article {+ width: 100%;+ padding: 32px 36px;+ text-align: center;+ background: var(--card-bg);+ border: 1px solid var(--card-border);+ border-radius: 16px;+ box-shadow: 0 16px 40px rgb(30 50 10 / 25%);}h1 {- font-size: 22px;- font-weight: 600;- line-height: 1.3;- margin-bottom: 12px;- color: var(--text-primary);+ font-size: 20px;+ font-weight: 700;+ line-height: 25px;+ letter-spacing: -0.5px;}h1+p {- font-size: 15px;- line-height: 1.6;+ margin-top: 8px;+ font-size: 14px;+ line-height: 20px;color: var(--text-secondary);- margin-bottom: 32px;}nav {display: flex;+ flex-direction: column;gap: 12px;- justify-content: center;- }-- nav span[aria-hidden="true"] {- font-size: 18px;+ margin-top: 24px;}- nav a,- #redirect-go-now {+ /* The 3D frame the app's LemonButton draws under every button. */+ .btn {position: relative;- display: inline-flex;+ display: flex;align-items: center;+ justify-content: center;gap: 8px;- background: transparent;- color: var(--text-primary);+ min-height: 49px;+ padding: 8px 16px;font-family: inherit;- font-size: 0.875rem;+ font-size: 16px;font-weight: 500;- line-height: 1.5rem;+ color: var(--text-primary);text-decoration: none;- padding: 8px 20px;- border: 1px solid var(--button-border);- border-radius: var(--radius);- box-shadow: 0 3px 0 -1px var(--button-frame);cursor: pointer;- transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;+ background: var(--control-bg);+ border: 1px solid var(--control-border);+ border-radius: var(--radius);+ box-shadow: 0 3px 0 0 var(--control-frame);+ transition: border-color 200ms ease, box-shadow 200ms ease, translate 200ms ease;}- nav a:hover,- #redirect-go-now:hover {- border-color: var(--button-border-hover);- transform: translateY(-0.5px);- box-shadow: 0 3.5px 0 -1px var(--button-frame);+ .btn:hover {+ border-color: var(--control-border-hover);}- nav a:active,- #redirect-go-now:active {- transform: translateY(0.5px);- box-shadow: 0 2.5px 0 -1px var(--button-frame);+ .btn:active {+ translate: 0 3px;+ box-shadow: none;}- nav a:focus-visible,- button:focus-visible,- #redirect-go-now:focus-visible {- outline: 2px solid var(--brand-blue);+ .btn:focus-visible {+ outline: 2px solid var(--accent-border);outline-offset: 2px;}+ .flag {+ font-size: 18px;+ line-height: 1;+ }++ /* Corner badge on the region the browser was last signed in to. */+ .last-used {+ position: absolute;+ top: 6px;+ right: 8px;+ padding: 1px 6px;+ font-size: 11px;+ font-weight: 500;+ line-height: 16px;+ color: var(--accent-blue);+ background: rgb(50 128 255 / 10%);+ border-radius: 4px;+ }++ /* Too little width left of the badge for the centered region name to clear it, so the+ badge joins the row instead, and wraps below the name when even that does not fit. */+ @media (max-width: 575px) {+ .btn {+ flex-wrap: wrap;+ }++ .last-used {+ position: static;+ }+ }++ .btn--primary {+ background: var(--accent);+ border-color: var(--accent-border);+ box-shadow: 0 3px 0 0 var(--accent-border);+ }++ .btn--primary:hover {+ border-color: var(--accent-border-hover);+ }++ .btn--small {+ min-height: 36px;+ font-size: 14px;+ }+noscript p,#hint-default {margin-top: 24px;font-size: 13px;+ line-height: 19px;color: var(--text-secondary);}noscript p a,#hint-default a {color: var(--text-secondary);- text-decoration: underline;text-underline-offset: 2px;}@@ -171,96 +275,62 @@color: var(--text-primary);}- #redirect-banner {- margin-top: 28px;- padding: 16px 20px;- background: var(--bg);- border-radius: var(--radius);+ footer {+ margin-top: 20px;font-size: 14px;- color: var(--text-primary);- line-height: 1.5;+ line-height: 20px;+ color: var(--text-footer);}- #redirect-region-name {- font-weight: 600;+ footer a {+ color: inherit;+ text-underline-offset: 2px;}- #progress-bar {- width: 100%;- height: 4px;- background: var(--border);- border-radius: 2px;- margin-top: 12px;- overflow: hidden;+ footer a:hover {+ color: var(--text-primary);}- #progress-fill {- height: 100%;- background: var(--brand-blue);- border-radius: 2px;- width: 0%;- transition: width 100ms linear;+ @media (prefers-reduced-motion: no-preference) {+ main {+ animation: rise 0.28s cubic-bezier(0.16, 1, 0.3, 1);+ }}- #redirect-banner>div:has(> button) {- display: flex;- align-items: center;- justify-content: center;- gap: 12px;- margin-top: 14px;- }+ @media (prefers-reduced-motion: reduce) {- button {- display: inline-flex;- align-items: center;- background: transparent;- color: var(--text-primary);- font-family: inherit;- font-size: 0.8125rem;- font-weight: 500;- line-height: 1.5rem;- padding: 6px 14px;- border: 1px solid var(--border);- border-radius: var(--radius);- cursor: pointer;- transition: border-color 200ms ease;- appearance: none;- margin: 0;- }+ .btn,+ #caret {+ transition: none;+ animation: none;+ }- button:hover {- border-color: var(--text-secondary);+ .btn:active {+ translate: none;+ }}- footer {- text-align: center;- margin-top: 20px;- font-size: 13px;- color: var(--text-secondary);- }+ @keyframes blink {- footer a {- color: var(--text-secondary);- text-decoration: underline;- text-underline-offset: 2px;- }+ 0%,+ 50% {+ opacity: 1;+ }- footer a:hover {- color: var(--text-primary);+ 50.01%,+ 100% {+ opacity: 0;+ }}- @media (prefers-reduced-motion: reduce) {-- nav a,- #redirect-go-now,- #progress-fill {- transition: none;+ @keyframes rise {+ from {+ opacity: 0;+ transform: translateY(8px);}- nav a:hover,- nav a:active,- #redirect-go-now:hover,- #redirect-go-now:active {+ to {+ opacity: 1;transform: none;}}@@ -268,81 +338,112 @@</head><body>+ <!-- Decorative, and never translated: an in-page translator replaces the text nodes the+ typewriter below rewrites on every tick. -->+ <div aria-hidden="true" id="notes" translate="no">+ <div>// oauth.posthog.com<span id="caret"></span></div>+ <div></div>+ </div>+<main>- <article>- <header>- <svg aria-hidden="true" fill="none" height="30" viewBox="0 0 157 30" xmlns="http://www.w3.org/2000/svg">- <clipPath id="a">- <path d="m0 0h157v30h-157z" />- </clipPath>- <g clip-path="url(#a)">- <path- d="m10.8914 17.2058c-.3685.7371-1.42034.7371-1.78887 0l-.88136-1.7627c-.14077-.2815-.14077-.6129 0-.8944l.88136-1.7628c.36853-.737 1.42037-.737 1.78887 0l.8814 1.7628c.1407.2815.1407.6129 0 .8944z"- class="logo-fill-blue" />- <path- d="m10.8914 27.2029c-.3685.737-1.42034.737-1.78887 0l-.88136-1.7627c-.14077-.2816-.14077-.6129 0-.8945l.88136-1.7627c.36853-.7371 1.42037-.7371 1.78887 0l.8814 1.7627c.1407.2816.1407.6129 0 .8945z"- class="logo-fill-blue" />- <path- d="m0 23.4082c0-.8909 1.07714-1.3371 1.70711-.7071l4.58338 4.5834c.62997.63.1838 1.7071-.7071 1.7071h-4.583391c-.552284 0-.999999-.4477-.999999-1zm0-4.8278c0 .2652.105357.5196.292893.7071l9.411217 9.4112c.18753.1875.44189.2929.70709.2929h5.1692c.8909 0 1.3371-1.0771.7071-1.7071l-14.58039-14.5804c-.62997-.63-1.70711-.1838-1.70711.7071zm0-9.99701c0 .26521.105357.51957.292893.7071l19.408207 19.40821c.1875.1875.4419.2929.7071.2929h5.1692c.8909 0 1.3371-1.0771.7071-1.7071l-24.57739-24.57739c-.62996-.62996-1.70711-.1838-1.70711.7071zm9.997 0c0 .26521.1054.51957.2929.7071l17.994 17.99401c.63.63 1.7071.1838 1.7071-.7071v-5.1692c0-.2652-.1054-.5196-.2929-.7071l-17.994-17.994c-.63-.62996-1.7071-.18379-1.7071.70711zm11.7041-5.87628c-.63-.62997-1.7071-.1838-1.7071.7071v5.16918c0 .26521.1054.51957.2929.7071l7.997 7.99701c.63.63 1.7071.1838 1.7071-.7071v-5.1692c0-.2652-.1054-.5196-.2929-.7071z"- class="logo-fill-yellow" />- <path- d="m42.5249 23.531-9.4128-9.4128c-.6299-.6299-1.7071-.1838-1.7071.7071v13.1665c0 .5522.4477 1 1 1h14.5807c.5522 0 1-.4478 1-1v-1.1991c0-.5523-.4496-.9933-.9973-1.0646-1.6808-.2188-3.2528-.9864-4.4635-2.1971zm-6.3213 2.2617c-.8829 0-1.5995-.7166-1.5995-1.5995s.7166-1.5995 1.5995-1.5995 1.5995.7166 1.5995 1.5995-.7166 1.5995-1.5995 1.5995z"- class="logo-fill-text" />- <path- d="m0 27.9917c0 .5523.447715 1 1 1h4.58339c.8909 0 1.33707-1.0771.70711-1.7071l-4.58339-4.5834c-.62997-.6299-1.70711-.1838-1.70711.7072z"- class="logo-fill-blue" />- <path- d="m9.997 10.997-8.28989-8.28989c-.62997-.62997-1.70711-.1838-1.70711.7071v5.16918c0 .26521.105357.51957.292893.7071l9.704107 9.70411z"- class="logo-fill-blue" />- <path- d="m1.70711 12.7042c-.62997-.63-1.70711-.1838-1.70711.7071v5.1692c0 .2652.105357.5195.292893.7071l9.704107 9.7041v-7.9976z"- class="logo-fill-blue" />- <path- d="m19.9939 11.4112c0-.2652-.1053-.5196-.2928-.7071l-7.997-7.99699c-.63-.62997-1.70715-.1838-1.70715.7071v5.16918c0 .26521.10535.51957.29285.7071l9.7041 9.70411z"- class="logo-fill-orange" />- <path d="m9.99707 28.9917h5.58343c.8909 0 1.337-1.0771.7071-1.7071l-6.29053-6.2905z"- class="logo-fill-orange" />- <path- d="m9.99707 10.9971v7.5834c0 .2652.10533.5195.29293.7071l9.7041 9.7041v-7.5834c0-.2652-.1054-.5196-.2929-.7071z"- class="logo-fill-orange" />- <g class="logo-fill-text">- <path- d="m59.6497 24.9998h4.108v-6.812h3.432c3.77 0 6.188-2.236 6.188-5.694 0-3.45799-2.418-5.694-6.188-5.694h-7.54zm4.108-10.322v-4.368h3.016c1.56 0 2.496.832 2.496 2.184s-.936 2.184-2.496 2.184z" />- <path- d="m80.8096 25.2078c4.004 0 6.916-2.86 6.916-6.76s-2.912-6.76-6.916-6.76c-4.056 0-6.916 2.86-6.916 6.76s2.86 6.76 6.916 6.76zm-3.12-6.76c0-2.08 1.248-3.51 3.12-3.51 1.846 0 3.094 1.43 3.094 3.51s-1.248 3.51-3.094 3.51c-1.872 0-3.12-1.43-3.12-3.51z" />- <path- d="m94.2995 25.2078c3.068 0 5.148-1.924 5.148-4.186 0-5.304-7.046-3.588-7.046-5.668 0-.572.598-.936 1.456-.936.884 0 1.95.546 2.288 1.742l3.068-1.274c-.598-1.898-2.808-3.198-5.486-3.198-2.886 0-4.68 1.716-4.68 3.77 0 4.966 6.942 3.588 6.942 5.642 0 .728-.676 1.222-1.69 1.222-1.456 0-2.47-1.014-2.782-2.236l-3.068 1.196c.676 1.976 2.652 3.926 5.85 3.926z" />- <path- d="m109.33 24.8698-.26-3.302c-.442.234-1.014.312-1.482.312-.936 0-1.56-.676-1.56-1.846v-4.966h3.172v-3.172h-3.172v-3.796h-3.822v3.796h-2.08v3.172h2.08v5.46c0 3.172 2.158 4.68 4.992 4.68.78 0 1.508-.13 2.132-.338z" />- <path- d="m122.656 6.7998v7.072h-7.228v-7.072h-4.108v18.2h4.108v-7.618h7.228v7.618h4.134v-18.2z" />- <path- d="m135.908 25.2078c4.004 0 6.916-2.86 6.916-6.76s-2.912-6.76-6.916-6.76c-4.056 0-6.916 2.86-6.916 6.76s2.86 6.76 6.916 6.76zm-3.12-6.76c0-2.08 1.248-3.51 3.12-3.51 1.846 0 3.094 1.43 3.094 3.51s-1.248 3.51-3.094 3.51c-1.872 0-3.12-1.43-3.12-3.51z" />- <path- d="m150.201 24.5838c1.43 0 2.704-.494 3.38-1.352v1.248c0 1.456-1.17 2.47-2.964 2.47-1.274 0-2.392-.624-2.574-1.69l-3.484.546c.468 2.47 2.99 4.134 6.058 4.134 4.03 0 6.708-2.366 6.708-5.876v-12.168h-3.77v1.118c-.702-.806-1.898-1.326-3.432-1.326-3.64 0-5.928 2.496-5.928 6.448s2.288 6.448 6.006 6.448zm-2.288-6.448c0-1.95 1.144-3.198 2.912-3.198 1.794 0 2.938 1.248 2.938 3.198s-1.144 3.198-2.938 3.198c-1.768 0-2.912-1.248-2.912-3.198z" />- </g>- </g>- </svg>- </header>+ <!-- The landscape gradient lockup from @posthog/brand (`<Logo />`), inlined because a+ Worker cannot render the React component. Re-copy it when the brand package+ changes the mark. -->+ <svg aria-hidden="true" fill="none" id="logo" viewBox="0 0 160 28" xmlns="http://www.w3.org/2000/svg">+ <g clip-path="url(#logo-landscape-color-gradient-clip0_56_1021)">+ <path fill="#111"+ d="M51.66 25.22A1.9 1.9 0 0 0 50 23.33l-.34-.04c-1-.13-1.94-.6-2.65-1.33L33.28 7.75V28H49a2.66 2.66 0 0 0 2.67-2.67zM39.2 23.54h-.09a1.78 1.78 0 1 1 .1 0" />+ <path fill="url(#logo-landscape-color-gradient-paint0_linear_56_1021)"+ d="M21.96 2.67v4.96l11.3 11.6h.02V7.75L26.63.85a2.8 2.8 0 0 0-2-.85 2.67 2.67 0 0 0-2.67 2.67" />+ <path fill="url(#logo-landscape-color-gradient-paint1_linear_56_1021)"+ d="M21.96 7.63v11.05L31.03 28h2.25v-8.75z" />+ <path fill="url(#logo-landscape-color-gradient-paint2_linear_56_1021)" d="M21.96 28h9.07l-9.07-9.32z" />+ <path fill="url(#logo-landscape-color-gradient-paint3_linear_56_1021)"+ d="M10.74 2.66v4.5l11.22 11.52V7.63L15.3.8a2.66 2.66 0 0 0-4.56 1.86" />+ <path fill="url(#logo-landscape-color-gradient-paint4_linear_56_1021)" d="M10.74 28h8.96l-8.96-9.32z" />+ <path fill="url(#logo-landscape-color-gradient-paint5_linear_56_1021)"+ d="M10.74 7.16v11.52L19.7 28h2.26v-9.32z" />+ <path fill="url(#logo-landscape-color-gradient-paint6_linear_56_1021)"+ d="M10.74 7.16 4.54.8A2.66 2.66 0 0 0 0 2.66V7.5l10.74 11.18z" />+ <path fill="url(#logo-landscape-color-gradient-paint7_linear_56_1021)"+ d="M9.19 28h1.55v-9.32L0 7.5v10.73z" />+ <path fill="url(#logo-landscape-color-gradient-paint8_linear_56_1021)"+ d="M0 25.41A2.6 2.6 0 0 0 2.58 28H9.2L0 18.23z" />+ </g>+ <path fill="#111"+ d="M64.9 22.88c-.67 0-1.23-.56-1.23-1.24V5.24c0-.69.56-1.24 1.24-1.24h6.55c3.89 0 6.39 2.32 6.39 5.9 0 3.6-2.5 5.91-6.4 5.91h-3.53v5.83c0 .68-.56 1.24-1.24 1.24zm3.02-11.94c0 .68.55 1.23 1.23 1.23h1.88c1.6 0 2.58-.86 2.58-2.26s-.97-2.27-2.58-2.27h-1.88c-.68 0-1.23.55-1.23 1.23zM84.71 23.1c-4.18 0-7.14-2.97-7.14-7.02s2.96-7.01 7.14-7.01c4.14 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.3 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m16.34 7.03a6.2 6.2 0 0 1-5.54-3.01c-.34-.57-.01-1.26.6-1.5l.77-.3c.7-.27 1.45.15 1.92.73a2.8 2.8 0 0 0 2.25 1.08c1.05 0 1.75-.51 1.75-1.27 0-2.13-7.17-.7-7.17-5.85 0-2.13 1.85-3.91 4.83-3.91 2.27 0 4.2.9 5.17 2.31.36.53.05 1.2-.54 1.44l-.85.35c-.68.29-1.45-.14-2-.63a2.5 2.5 0 0 0-1.64-.64c-.89 0-1.5.38-1.5.97 0 2.16 7.27.38 7.27 5.88 0 2.35-2.15 4.34-5.32 4.34m14.64-1.31c.04.57-.3 1.1-.86 1.2q-.6.1-1.27.11c-2.92 0-5.15-1.56-5.15-4.85v-5.66h-.91c-.69 0-1.24-.56-1.24-1.24v-.82c0-.68.55-1.23 1.24-1.23h.91v-2.7c0-.69.55-1.24 1.23-1.24h1.48c.68 0 1.24.55 1.24 1.23v2.7h2.04c.68 0 1.23.56 1.23 1.24v.82c0 .68-.55 1.24-1.23 1.24h-2.04v5.15c0 1.2.64 1.91 1.6 1.91.75 0 1.6.5 1.66 1.25zM125.5 5.23c0-.68.55-1.23 1.23-1.23h1.8c.68 0 1.23.55 1.23 1.23v16.41c0 .68-.55 1.24-1.23 1.24h-1.8c-.68 0-1.23-.56-1.23-1.24v-5.43c0-.68-.56-1.23-1.24-1.23h-5c-.67 0-1.23.55-1.23 1.23v5.43c0 .68-.55 1.24-1.23 1.24h-1.77c-.69 0-1.24-.56-1.24-1.24V5.24c0-.69.55-1.24 1.24-1.24h1.77c.68 0 1.23.55 1.23 1.23v4.87c0 .68.56 1.23 1.24 1.23h5c.67 0 1.23-.55 1.23-1.23zm12.87 17.87c-4.19 0-7.14-2.97-7.14-7.02s2.95-7.01 7.14-7.01c4.13 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.29 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m17.17 6.37c-3.84 0-6.2-2.58-6.2-6.68s2.36-6.69 6.12-6.69c1.58 0 2.82.54 3.54 1.37 0-.64.52-1.15 1.16-1.15h1.5c.68 0 1.24.55 1.24 1.23V21.9c0 3.64-2.77 6.09-6.93 6.09-2.64 0-4.9-1.2-5.85-3.09-.31-.62.16-1.29.85-1.4l1.14-.17c.67-.11 1.29.4 1.78.85.5.46 1.26.7 2.08.7 1.85 0 3.06-1.04 3.06-2.55v-1.3c-.7.9-2.01 1.4-3.49 1.4m-2.36-6.68c0 2.02 1.18 3.31 3 3.31 1.86 0 3.04-1.29 3.04-3.31s-1.18-3.32-3.03-3.32c-1.83 0-3.01 1.3-3.01 3.32" />+ <defs>+ <linearGradient id="logo-landscape-color-gradient-paint0_linear_56_1021" x1="21.96" x2="33.28" y1="9.62"+ y2="9.62" gradientUnits="userSpaceOnUse">+ <stop stop-color="#ffd849" />+ <stop offset=".96" stop-color="#fbae01" />+ </linearGradient>+ <linearGradient id="logo-landscape-color-gradient-paint1_linear_56_1021" x1="21.96" x2="33.28"+ y1="17.81" y2="17.81" gradientUnits="userSpaceOnUse">+ <stop stop-color="#ffb700" />+ <stop offset="1" stop-color="#f9aa01" />+ </linearGradient>+ <linearGradient id="logo-landscape-color-gradient-paint2_linear_56_1021" x1="21.96" x2="31.03"+ y1="23.34" y2="23.34" gradientUnits="userSpaceOnUse">+ <stop stop-color="#ff9500" />+ <stop offset="1" stop-color="#f8aa00" />+ </linearGradient>+ <linearGradient id="logo-landscape-color-gradient-paint3_linear_56_1021" x1="10.74" x2="21.96" y1="9.34"+ y2="9.34" gradientUnits="userSpaceOnUse">+ <stop stop-color="#ff651e" />+ <stop offset="1" stop-color="#e4400a" />+ </linearGradient>+ <linearGradient id="logo-landscape-color-gradient-paint4_linear_56_1021" x1="10.74" x2="19.7" y1="23.34"+ y2="23.34" gradientUnits="userSpaceOnUse">+ <stop stop-color="#c42c00" />+ <stop offset="1" stop-color="#d63600" />+ </linearGradient>+ <linearGradient id="logo-landscape-color-gradient-paint5_linear_56_1021" x1="10.74" x2="21.96"+ y1="17.58" y2="17.58" gradientUnits="userSpaceOnUse">+ <stop stop-color="#ef3c00" />+ <stop offset="1" stop-color="#d63601" />+ </linearGradient>+ <linearGradient id="logo-landscape-color-gradient-paint6_linear_56_1021" x1="0" x2="10.74" y1="9.34"+ y2="9.34" gradientUnits="userSpaceOnUse">+ <stop stop-color="#3f80ff" />+ <stop offset="1" stop-color="#084fe0" />+ </linearGradient>+ <linearGradient id="logo-landscape-color-gradient-paint7_linear_56_1021" x1="0" x2="10.74" y1="17.75"+ y2="17.75" gradientUnits="userSpaceOnUse">+ <stop stop-color="#0255ff" />+ <stop offset="1" stop-color="#0145d2" />+ </linearGradient>+ <linearGradient id="logo-landscape-color-gradient-paint8_linear_56_1021" x1="0" x2="9.19" y1="23.11"+ y2="23.11" gradientUnits="userSpaceOnUse">+ <stop stop-color="#0041c6" />+ <stop offset="1" stop-color="#0045d0" />+ </linearGradient>+ <clipPath id="logo-landscape-color-gradient-clip0_56_1021">+ <path fill="#fff" d="M0 0h51.67v28H0z" />+ </clipPath>+ </defs>+ </svg>+ <article><h1>Authenticate with PostHog</h1><p>Where is your PostHog project hosted?</p><nav aria-label="Select PostHog region">- <a id="btn-us" href="#">- <span aria-hidden="true">🇺🇸</span>+ <a class="btn" id="btn-us" href="#">+ <span aria-hidden="true" class="flag">🇺🇸</span>US Cloud+ <span class="last-used" hidden>Last used</span></a>- <a id="btn-eu" href="#">- <span aria-hidden="true">🇪🇺</span>+ <a class="btn" id="btn-eu" href="#">+ <span aria-hidden="true" class="flag">🇪🇺</span>EU Cloud+ <span class="last-used" hidden>Last used</span></a></nav><noscript>- <p>Enable JavaScript to continue. Your OAuth login parameters are required from this page.- </p>+ <p>Enable JavaScript to continue. Your OAuth login parameters are required from this page.</p></noscript><p id="hint-default">@@ -352,18 +453,6 @@<a href="https://eu.posthog.com" rel="noopener noreferrer" target="_blank">eu.posthog.com</a></p>- <div aria-live="polite" hidden id="redirect-banner">- <span>You last logged in on <span id="redirect-region-name"></span>. Redirecting- in <span id="redirect-countdown">7</span>s...</span>- <div aria-label="Redirect countdown" aria-valuemax="100" aria-valuemin="0" aria-valuenow="0"- id="progress-bar" role="progressbar">- <div id="progress-fill"></div>- </div>- <div>- <button id="redirect-cancel" type="button">Cancel redirect</button>- <a id="redirect-go-now"></a>- </div>- </div></article><footer>@@ -382,60 +471,45 @@document.getElementById('btn-us').href = buildUrl('us');document.getElementById('btn-eu').href = buildUrl('eu');- // Auto-redirect if user has previously logged in to a region+ var prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;++ // Type the second corner note, matching the login scene's typewriter.+ (function () {+ var line = '// choose your data region';+ var target = document.getElementById('notes').lastElementChild;+ var caret = document.getElementById('caret');+ if (prefersReducedMotion) {+ target.textContent = line;+ target.appendChild(caret);+ return;+ }+ var shown = 0;+ var id = setInterval(function () {+ shown++;+ target.textContent = line.slice(0, shown);+ target.appendChild(caret);+ if (shown >= line.length) {+ clearInterval(id);+ }+ }, 42);+ })();++ // Mark the region this browser last used. The worker already redirected anyone with a+ // single live session (see soleLiveRegion in handlers/authorize.ts), so reaching this page+ // means the answer is genuinely ambiguous and the choice is the visitor's to make.(function () {- var REDIRECT_SECONDS = 7;- var prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;var cookie = document.cookie.split('; ').find(function (c) { return c.startsWith('ph_current_instance='); });if (!cookie) return;-var value = decodeURIComponent(cookie.substring(cookie.indexOf('=') + 1)).replace(/"/g, '');- var region = null;try {var hostname = new URL(value).hostname;- if (hostname === 'us.posthog.com') region = 'us';- else if (hostname === 'eu.posthog.com') region = 'eu';- } catch (e) { return; }- if (!region) return;-- var regionLabel = region === 'us' ? 'US Cloud' : 'EU Cloud';- var redirectUrl = buildUrl(region);-- document.getElementById('hint-default').hidden = true;- document.getElementById('redirect-banner').hidden = false;- document.getElementById('redirect-region-name').textContent = regionLabel;- document.getElementById('redirect-go-now').textContent = 'Go to ' + regionLabel + ' now';- document.getElementById('redirect-go-now').href = redirectUrl;-- var startTime = Date.now();- var fill = document.getElementById('progress-fill');- var progressBar = document.getElementById('progress-bar');- var countdown = document.getElementById('redirect-countdown');- var timer = null;-- function tick() {- var elapsed = Date.now() - startTime;- var progress = Math.min(elapsed / (REDIRECT_SECONDS * 1000), 1);- var percent = Math.round(progress * 100);- if (!prefersReducedMotion) {- fill.style.width = percent + '%';- progressBar.setAttribute('aria-valuenow', String(percent));- }- countdown.textContent = Math.max(0, Math.ceil(REDIRECT_SECONDS - elapsed / 1000));- if (progress >= 1) {- window.location.href = redirectUrl;- return;+ var region = hostname === 'us.posthog.com' ? 'us' : hostname === 'eu.posthog.com' ? 'eu' : null;+ if (region) {+ document.querySelector('#btn-' + region + ' .last-used').hidden = false;}- timer = requestAnimationFrame(tick);- }- timer = requestAnimationFrame(tick);-- document.getElementById('redirect-cancel').addEventListener('click', function () {- cancelAnimationFrame(timer);- document.getElementById('redirect-banner').hidden = true;- document.getElementById('hint-default').hidden = false;- });+ } catch (e) { /* not a region we know */ }})();+</script></body>diff --git a/services/oauth-proxy/src/types.d.ts b/services/oauth-proxy/src/types.d.tsindex e80becf50dfa..4cb495f1353a 100644--- a/services/oauth-proxy/src/types.d.ts+++ b/services/oauth-proxy/src/types.d.ts@@ -2,3 +2,8 @@ declare module '*.html' {const content: stringexport default content}++declare module '*.woff2' {+ const content: ArrayBuffer+ export default content+}diff --git a/services/oauth-proxy/tests/authorize.test.ts b/services/oauth-proxy/tests/authorize.test.tsindex 1f24bcd5f5a9..27bdcfafff42 100644--- a/services/oauth-proxy/tests/authorize.test.ts+++ b/services/oauth-proxy/tests/authorize.test.ts@@ -27,6 +27,37 @@ describe('handleAuthorize', () => {expect(html).toContain('EU Cloud')})+ it.each([+ ['neither region cookie', ''],+ ['both region cookies', 'ph_authenticated_us=1; ph_authenticated_eu=1'],+ ['only the Strict cookie the proxy never receives', 'ph_current_instance="https://eu.posthog.com"'],+ ])('shows region picker with %s', async (_label, cookie) => {+ const request = new Request(+ 'https://oauth.posthog.com/oauth/authorize/?client_id=abc&redirect_uri=http://localhost:3000/callback&response_type=code',+ cookie ? { headers: { Cookie: cookie } } : undefined+ )+ const response = await handleAuthorize(request, mockKV)++ expect(response.status).toBe(200)+ })++ it.each([+ ['us', 'ph_authenticated_us=1', 'https://us.posthog.com/oauth/authorize/'],+ ['eu', 'ph_authenticated_eu=1', 'https://eu.posthog.com/oauth/authorize/'],+ ])('redirects to %s without the picker when only that region has a live session', async (_region, cookie, base) => {+ const request = new Request(+ 'https://oauth.posthog.com/oauth/authorize/?client_id=abc&redirect_uri=http://localhost:3000/callback&response_type=code&state=xyz',+ { headers: { Cookie: `${cookie}; ph_current_instance="https://us.posthog.com"` } }+ )+ const response = await handleAuthorize(request, mockKV)++ expect(response.status).toBe(302)+ const location = new URL(response.headers.get('location') as string)+ expect(`${location.origin}${location.pathname}`).toBe(base)+ expect(location.searchParams.get('client_id')).toBe('abc')+ expect(location.searchParams.get('_region')).toBeNull()+ })+it('redirects to US authorize with translated client_id and proxy callback when _region=us', async () => {const mapping = {us_client_id: 'us_real_id',diff --git a/services/oauth-proxy/tests/fonts.test.ts b/services/oauth-proxy/tests/fonts.test.tsnew file mode 100644index 000000000000..dc97564aea22--- /dev/null+++ b/services/oauth-proxy/tests/fonts.test.ts@@ -0,0 +1,34 @@+import { describe, expect, it } from 'vitest'++import { FONT_PATHS, handleFont } from '@/handlers/fonts'++import REGION_PICKER_HTML from '../src/static/region-picker.html'++// woff2 files start with this signature, so a wrong bundler rule shows up as a different body.+const WOFF2_SIGNATURE = 'wOF2'++describe('handleFont', () => {+ it.each(FONT_PATHS)('serves %s as a woff2 font', async (path) => {+ const response = handleFont(new Request(`https://oauth.posthog.com${path}`))++ expect(response.status).toBe(200)+ expect(response.headers.get('content-type')).toBe('font/woff2')++ const body = await response.arrayBuffer()+ expect(body.byteLength).toBeGreaterThan(0)+ expect(new TextDecoder().decode(body.slice(0, 4))).toBe(WOFF2_SIGNATURE)+ })++ it('serves every face the region picker asks for', () => {+ const requested = [...REGION_PICKER_HTML.matchAll(/url\('(\/static\/fonts\/[^']+)'\)/g)].map(+ (match) => match[1]+ )++ expect(requested.length).toBeGreaterThan(0)+ expect(new Set(requested)).toEqual(new Set(FONT_PATHS))+ })++ it('returns 404 for a face it does not bundle', () => {+ expect(handleFont(new Request('https://oauth.posthog.com/static/fonts/RoundHog-Bold.woff2')).status).toBe(404)+ })+})diff --git a/services/oauth-proxy/vitest.config.mts b/services/oauth-proxy/vitest.config.mtsindex 2ccb1b9b9c81..f0324718eb3e 100644--- a/services/oauth-proxy/vitest.config.mts+++ b/services/oauth-proxy/vitest.config.mts@@ -3,6 +3,24 @@ import type { Plugin } from 'vite'import tsconfigPaths from 'vite-tsconfig-paths'import { defineConfig } from 'vitest/config'+// Mirrors the Data rule in wrangler.jsonc, so tests see the same ArrayBuffer the Worker gets.+function binaryRawPlugin(): Plugin {+ return {+ name: 'binary-raw',+ transform(_code, id) {+ if (id.endsWith('.woff2')) {+ const base64 = readFileSync(id).toString('base64')+ return {+ code: `const bytes = Buffer.from(${JSON.stringify(base64)}, 'base64');+export default bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);`,+ map: null,+ }+ }+ },+ }+}++// Mirrors the Text rule in wrangler.jsonc.function htmlRawPlugin(): Plugin {return {name: 'html-raw',@@ -16,7 +34,7 @@ function htmlRawPlugin(): Plugin {}export default defineConfig({- plugins: [tsconfigPaths(), htmlRawPlugin()],+ plugins: [tsconfigPaths(), htmlRawPlugin(), binaryRawPlugin()],test: {environment: 'node',},diff --git a/services/oauth-proxy/wrangler.jsonc b/services/oauth-proxy/wrangler.jsoncindex 85a325235499..ee3fc3ce622c 100644--- a/services/oauth-proxy/wrangler.jsonc+++ b/services/oauth-proxy/wrangler.jsonc@@ -21,6 +21,13 @@"globs": ["src/static/**/*.html"],"fallthrough": true,},+ // The RoundHog faces the region picker serves are imported as ArrayBuffers from+ // @posthog/brand, so the page needs no third-party font host. See src/handlers/fonts.ts.+ {+ "type": "Data",+ "globs": ["**/*.woff2"],+ "fallthrough": true,+ },],"kv_namespaces": [{