github mapping, signup

This commit is contained in:
peintnermax
2023-07-28 15:23:17 +02:00
parent c17a2bad87
commit 83000f1700
9 changed files with 595 additions and 55 deletions

View File

@@ -27,8 +27,8 @@ export function AddressBar({ domain }: Props) {
</svg>
</div>
<div className="flex space-x-1 text-sm font-medium">
<div>
<span className="px-2 text-gray-500">{domain}</span>
<div className="max-w-[150px] px-2 overflow-hidden text-gray-500 text-ellipsis">
<span className="whitespace-nowrap">{domain}</span>
</div>
{pathname ? (
<>

View File

@@ -11,6 +11,7 @@ import {
SignInWithGithub,
} from "@zitadel/react";
import { useRouter } from "next/navigation";
import { ProviderSlug } from "#/lib/demos";
export interface SignInWithIDPProps {
children?: ReactNode;
@@ -22,7 +23,7 @@ export function SignInWithIDP({ identityProviders }: SignInWithIDPProps) {
const [error, setError] = useState<string>("");
const router = useRouter();
async function startFlow(idp: any) {
async function startFlow(idp: any, provider: ProviderSlug) {
console.log("start flow");
const host = "http://localhost:3000";
setLoading(true);
@@ -34,8 +35,8 @@ export function SignInWithIDP({ identityProviders }: SignInWithIDPProps) {
},
body: JSON.stringify({
idpId: idp.id,
successUrl: `${host}`,
failureUrl: `${host}`,
successUrl: `${host}/register/idp/${provider}/success`,
failureUrl: `${host}/register/idp/${provider}/failure`,
}),
});
@@ -58,14 +59,26 @@ export function SignInWithIDP({ identityProviders }: SignInWithIDPProps) {
return (
<SignInWithGithub
key={`idp-${i}`}
name={idp.name}
onClick={() =>
startFlow(idp, ProviderSlug.GITHUB).then(({ authUrl }) => {
console.log("done");
router.push(authUrl);
})
}
// name={idp.name}
></SignInWithGithub>
);
case 7: // IdentityProviderType.IDENTITY_PROVIDER_TYPE_GITHUB_ES:
return (
<SignInWithGithub
key={`idp-${i}`}
name={idp.name}
// name={idp.name}
// onClick={() =>
// startFlow(idp, ProviderSlug.GITHUB).then(({ authUrl }) => {
// console.log("done");
// router.push(authUrl);
// })
// }
></SignInWithGithub>
);
case 5: // IdentityProviderType.IDENTITY_PROVIDER_TYPE_AZURE_AD:
@@ -79,9 +92,9 @@ export function SignInWithIDP({ identityProviders }: SignInWithIDPProps) {
return (
<SignInWithGoogle
key={`idp-${i}`}
name={idp.name}
// name={idp.name}
onClick={() =>
startFlow(idp).then(({ authUrl }) => {
startFlow(idp, ProviderSlug.GOOGLE).then(({ authUrl }) => {
console.log("done");
router.push(authUrl);
})