Merge pull request #10376 from supabase/fix/remove-autoSignIn

fix: remove auto sign in
This commit is contained in:
Alaister Young authored and GitHub committed 2022-11-17 15:48:00 +11:00
commit a74d43f99c
2 files changed
+2 -33

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ const JoinOrganizationPage = () => {
const { token_does_not_exist, email_match, expired_token, organization_name, invite_id } =
tokenValidationInfo || {}
const loginRedirectLink = `/?next=${encodeURIComponent(`/join?token=${token}&slug=${slug}`)}`
const loginRedirectLink = `/?returnTo=${encodeURIComponent(`/join?token=${token}&slug=${slug}`)}`
useEffect(() => {
const fetchTokenInfo = async () => {
+1 -32
View File
@@ -1,42 +1,11 @@
import SignInForm from 'components/interfaces/SignIn/SignInForm'
import SignInWithGitHub from 'components/interfaces/SignIn/SignInWithGitHub'
import { SignInLayout } from 'components/layouts'
import Connecting from 'components/ui/Loading'
import { auth } from 'lib/gotrue'
import Link from 'next/link'
import { NextRouter, useRouter } from 'next/router'
import { useEffect } from 'react'
import { NextPageWithLayout } from 'types'
// detect for redirect from 3rd party service like vercel, aws...
const isRedirectFromThirdPartyService = (router: NextRouter) => router.query.next !== undefined
const SignInPage: NextPageWithLayout = () => {
const router = useRouter()
const autoSignIn = isRedirectFromThirdPartyService(router)
useEffect(() => {
if (autoSignIn) {
const queryParams = (router.query as any) || {}
const params = new URLSearchParams(queryParams)
// trigger github signIn
auth.signInWithOAuth({
provider: 'github',
options: {
redirectTo: `${
process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview'
? process.env.NEXT_PUBLIC_VERCEL_URL
: process.env.NEXT_PUBLIC_SITE_URL
}?${params.toString()}`,
},
})
}
}, [])
return autoSignIn ? (
<Connecting />
) : (
return (
<>
<div className="flex flex-col gap-5">
<SignInWithGitHub />