docs: 📝 Improve configuration doc
This commit is contained in:
@ -3,6 +3,9 @@ ENCRYPTION_SECRET=SgVkYp2s5v8y/B?E(H+MbQeThWmZq4t6 #256-bits secret (can be gene
|
||||
NEXTAUTH_URL=http://localhost:3000
|
||||
NEXT_PUBLIC_VIEWER_URL=http://localhost:3001
|
||||
|
||||
NEXT_PUBLIC_GITHUB_CLIENT_ID=534b549dd17709a743a2
|
||||
GITHUB_CLIENT_SECRET=7adb03507504fb1a54422f6c3c697277cfd000a9
|
||||
|
||||
S3_ACCESS_KEY=minio
|
||||
S3_SECRET_KEY=minio123
|
||||
S3_BUCKET=typebot
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
Stack,
|
||||
HStack,
|
||||
useToast,
|
||||
Text,
|
||||
} from '@chakra-ui/react'
|
||||
import React, { ChangeEvent, FormEvent, useEffect } from 'react'
|
||||
import { useState } from 'react'
|
||||
@ -12,6 +13,14 @@ import { signIn, useSession } from 'next-auth/react'
|
||||
import { DividerWithText } from './DividerWithText'
|
||||
import { SocialLoginButtons } from './SocialLoginButtons'
|
||||
import { useRouter } from 'next/router'
|
||||
import { NextChakraLink } from 'components/nextChakra/NextChakraLink'
|
||||
|
||||
const hasNoAuthProvider =
|
||||
(!process.env.NEXT_PUBLIC_SMTP_FROM ||
|
||||
process.env.NEXT_PUBLIC_SMTP_AUTH_DISABLED === 'true') &&
|
||||
process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID &&
|
||||
process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID &&
|
||||
process.env.NEXT_PUBLIC_FACEBOOK_CLIENT_ID
|
||||
|
||||
type Props = {
|
||||
defaultEmail?: string
|
||||
@ -49,6 +58,21 @@ export const SignInForm = ({
|
||||
})
|
||||
setAuthLoading(false)
|
||||
}
|
||||
if (hasNoAuthProvider)
|
||||
return (
|
||||
<Text>
|
||||
You need to{' '}
|
||||
<NextChakraLink
|
||||
href="https://docs.typebot.io/self-hosting/configuration"
|
||||
isExternal
|
||||
color="blue.400"
|
||||
textDecor="underline"
|
||||
>
|
||||
configure at least one auth provider
|
||||
</NextChakraLink>{' '}
|
||||
(Email, Google, GitHub or Facebook).
|
||||
</Text>
|
||||
)
|
||||
return (
|
||||
<Stack spacing="4" w="330px">
|
||||
<SocialLoginButtons />
|
||||
|
@ -27,15 +27,17 @@ export const SocialLoginButtons = () => {
|
||||
|
||||
return (
|
||||
<Stack>
|
||||
<Button
|
||||
leftIcon={<GithubIcon />}
|
||||
onClick={handleGitHubClick}
|
||||
data-testid="github"
|
||||
isLoading={['loading', 'authenticated'].includes(status)}
|
||||
variant="outline"
|
||||
>
|
||||
Continue with GitHub
|
||||
</Button>
|
||||
{process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID && (
|
||||
<Button
|
||||
leftIcon={<GithubIcon />}
|
||||
onClick={handleGitHubClick}
|
||||
data-testid="github"
|
||||
isLoading={['loading', 'authenticated'].includes(status)}
|
||||
variant="outline"
|
||||
>
|
||||
Continue with GitHub
|
||||
</Button>
|
||||
)}
|
||||
{process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID && (
|
||||
<Button
|
||||
leftIcon={<GoogleLogo />}
|
||||
|
@ -12,15 +12,13 @@ import { User } from 'db'
|
||||
|
||||
const providers: Provider[] = []
|
||||
|
||||
providers.push(
|
||||
GitHubProvider({
|
||||
clientId:
|
||||
process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID ?? '534b549dd17709a743a2',
|
||||
clientSecret:
|
||||
process.env.GITHUB_CLIENT_SECRET ??
|
||||
'7adb03507504fb1a54422f6c3c697277cfd000a9',
|
||||
})
|
||||
)
|
||||
if (process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID)
|
||||
providers.push(
|
||||
GitHubProvider({
|
||||
clientId: process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID,
|
||||
clientSecret: process.env.GITHUB_CLIENT_SECRET,
|
||||
})
|
||||
)
|
||||
|
||||
if (
|
||||
process.env.NEXT_PUBLIC_SMTP_FROM &&
|
||||
|
Reference in New Issue
Block a user