Skip to content

: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.

1.2 KB
Raw Blame
import { useValues } from 'kea'

import { SSOEnforcedLoginButton } from 'lib/components/SocialLoginButton/SocialLoginButton'
import { useLastLoginMethod } from 'scenes/authentication/shared/lastLoginMethod'

import { loginLogic } from '../loginLogic'

export function LoginSingleSignOnButtons(): JSX.Element {
    const { precheckResponse, login } = useValues(loginLogic)
    const lastLoginMethod = useLastLoginMethod()

    return (
        <>
            {precheckResponse.sso_enforcement && (
                <SSOEnforcedLoginButton
                    provider={precheckResponse.sso_enforcement}
                    email={login.email}
                    isLastUsed={lastLoginMethod === precheckResponse.sso_enforcement}
                />
            )}
            {precheckResponse.saml_available && !precheckResponse.sso_enforcement && (
                <SSOEnforcedLoginButton provider="saml" email={login.email} isLastUsed={lastLoginMethod === 'saml'} />
            )}
            {precheckResponse.oidc_available && !precheckResponse.sso_enforcement && (
                <SSOEnforcedLoginButton provider="oidc" email={login.email} isLastUsed={lastLoginMethod === 'oidc'} />
            )}
        </>
    )
}