import React, { Fragment, useContext, useEffect, useState } from "react";
import { AuthRequestContext } from "../utils/authrequest";
import { Listbox } from "@headlessui/react";
import { Transition } from "@headlessui/react";
import { ChevronUpDownIcon, CheckIcon } from "@heroicons/react/24/solid";
import clsx from "clsx";
import { Buffer } from "buffer";
import { CopyToClipboard } from "react-copy-to-clipboard";
import BrowserOnly from "@docusaurus/BrowserOnly";
const LinkButton = ({
instance,
clientId,
redirectUri,
responseType,
prompt,
organizationId,
authMethod,
codeVerifier,
scope,
loginHint,
idTokenHint,
}) => {
const [copied, setCopied] = useState(false);
return (
code_challenge
urn:zitadel:iam:org:id:{organizationId}
Scopes
Request additional information about the user with scopes. The claims will be returned on the userinfo_endpoint or in the token (when configured). {allScopes.map((scope, scopeIndex) => { return (
{instance.endsWith("/") ? instance : instance + "/"}
oauth/v2/authorize?
{`client_id=${encodeURIComponent(
clientId
)}`}
{`&redirect_uri=${encodeURIComponent(
redirectUri
)}`}
{`&response_type=${encodeURIComponent(responseType)}`}
{`&scope=${encodeURIComponent(
scope
)}`}
{prompt && (
{`&prompt=${encodeURIComponent(
prompt
)}`}
)}
{loginHint && prompt === "select_account" && (
{`&login_hint=${encodeURIComponent(
loginHint
)}`}
)}
{authMethod === "(none) PKCE" && (
{`&code_challenge=${encodeURIComponent(
codeChallenge
)}&code_challenge_method=S256`}
)}
{
window.plausible("OIDC Playground", {
props: { method: "Try it out", pageloc: "Authorize" },
});
}}
target="_blank"
className="mt-2 flex flex-row items-center py-2 px-4 text-white bg-green-500 dark:bg-green-600 hover:dark:bg-green-500 hover:text-white rounded-md hover:no-underline font-semibold text-sm plausible-event-name=OIDC+Playground plausible-event-method=Try+it+out"
href={`${
instance.endsWith("/") ? instance : instance + "/"
}oauth/v2/authorize?client_id=${encodeURIComponent(
clientId
)}&redirect_uri=${encodeURIComponent(
redirectUri
)}&response_type=${encodeURIComponent(
responseType
)}&scope=${encodeURIComponent(scope)}${
prompt ? `&prompt=${encodeURIComponent(prompt)}` : ""
}${
loginHint && prompt === "select_account"
? `&login_hint=${encodeURIComponent(loginHint)}`
: ""
}${
authMethod === "(none) PKCE"
? `&code_challenge=${encodeURIComponent(
codeChallenge
)}&code_challenge_method=S256`
: ""
}`}
>
Try it out