diff --git a/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/CreateOAuth2AppPage.tsx b/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/CreateOAuth2AppPage.tsx
index b94606809b..cee9d6344b 100644
--- a/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/CreateOAuth2AppPage.tsx
+++ b/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/CreateOAuth2AppPage.tsx
@@ -2,15 +2,22 @@ import { postApp } from "api/queries/oauth2";
import { displayError, displaySuccess } from "components/GlobalSnackbar/utils";
import type { FC } from "react";
import { useMutation, useQueryClient } from "react-query";
-import { useNavigate } from "react-router";
+import { useNavigate, useSearchParams } from "react-router";
import { pageTitle } from "utils/page";
import { CreateOAuth2AppPageView } from "./CreateOAuth2AppPageView";
const CreateOAuth2AppPage: FC = () => {
const navigate = useNavigate();
+ const [searchParams] = useSearchParams();
const queryClient = useQueryClient();
const postAppMutation = useMutation(postApp(queryClient));
+ const defaultValues = {
+ name: searchParams.get("name") ?? "",
+ callback_url: searchParams.get("callback_url") ?? "",
+ icon: searchParams.get("icon") ?? "",
+ };
+
return (
<>
{pageTitle("New OAuth2 Application")}
@@ -18,6 +25,7 @@ const CreateOAuth2AppPage: FC = () => {
{
try {
const app = await postAppMutation.mutateAsync(req);
diff --git a/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/CreateOAuth2AppPageView.tsx b/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/CreateOAuth2AppPageView.tsx
index c4bcfb25cd..9d59db1269 100644
--- a/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/CreateOAuth2AppPageView.tsx
+++ b/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/CreateOAuth2AppPageView.tsx
@@ -16,12 +16,18 @@ type CreateOAuth2AppProps = {
isUpdating: boolean;
createApp: (req: TypesGen.PostOAuth2ProviderAppRequest) => void;
error?: unknown;
+ defaultValues?: {
+ name: string;
+ callback_url: string;
+ icon: string;
+ };
};
export const CreateOAuth2AppPageView: FC = ({
isUpdating,
createApp,
error,
+ defaultValues,
}) => {
return (
<>
@@ -51,6 +57,7 @@ export const CreateOAuth2AppPageView: FC = ({
onSubmit={createApp}
isUpdating={isUpdating}
error={error}
+ defaultValues={defaultValues}
/>
>
diff --git a/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/OAuth2AppForm.tsx b/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/OAuth2AppForm.tsx
index 0bb08327f5..2801e5fa28 100644
--- a/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/OAuth2AppForm.tsx
+++ b/site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/OAuth2AppForm.tsx
@@ -16,6 +16,11 @@ type OAuth2AppFormProps = {
error?: unknown;
isUpdating: boolean;
actions?: ReactNode;
+ defaultValues?: {
+ name: string;
+ callback_url: string;
+ icon: string;
+ };
};
export const OAuth2AppForm: FC = ({
@@ -24,6 +29,7 @@ export const OAuth2AppForm: FC = ({
error,
isUpdating,
actions,
+ defaultValues,
}) => {
const apiValidationErrors = isApiValidationError(error)
? mapApiErrorToFieldErrors(error.response.data)
@@ -46,7 +52,7 @@ export const OAuth2AppForm: FC = ({
= ({
= ({