Skip to content

Conversation

@sirily11
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings January 18, 2026 08:40
@vercel
Copy link

vercel bot commented Jan 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
rxlab-auth Ready Ready Preview, Comment Jan 18, 2026 9:01am

Request Review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds OAuth server endpoint configuration display in the admin UI. When creating a new OAuth client, administrators can now see and copy the OAuth server endpoints (issuer, authorization, token, and discovery URLs) needed to configure their OAuth client applications.

Changes:

  • Added a new OAuthEndpointsCard component that displays OAuth endpoints with copy-to-clipboard functionality
  • Integrated the endpoints card into the new client creation page above the client form
  • Added E2E tests to verify the endpoints are displayed correctly

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
components/admin/oauth-endpoints-card.tsx New component that displays OAuth server endpoints in a card with copy buttons for each endpoint
app/admin/dashboard/clients/new/page.tsx Updated to fetch OAuth configuration and display the endpoints card above the client form
e2e/admin/clients.spec.ts Added new test suite to verify OAuth endpoints display correctly on the new client page

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +17 to +41
test("should display OAuth endpoints on new client page", async ({ page }) => {
await page.goto("/admin/dashboard/clients/new");

// Verify OAuth endpoints card is visible
await expect(page.getByText("OAuth Server Endpoints")).toBeVisible();

// Verify key endpoints are displayed
await expect(page.getByTestId("oauth-endpoint-issuer")).toBeVisible();
await expect(page.getByTestId("oauth-endpoint-authorization")).toBeVisible();
await expect(page.getByTestId("oauth-endpoint-token")).toBeVisible();
await expect(page.getByTestId("oauth-endpoint-discovery")).toBeVisible();

// Verify endpoints have values
const issuerValue = await page.getByTestId("oauth-endpoint-issuer").inputValue();
expect(issuerValue).toBeTruthy();

const authValue = await page.getByTestId("oauth-endpoint-authorization").inputValue();
expect(authValue).toContain("/api/oauth/authorize");

const tokenValue = await page.getByTestId("oauth-endpoint-token").inputValue();
expect(tokenValue).toContain("/api/oauth/token");

const discoveryValue = await page.getByTestId("oauth-endpoint-discovery").inputValue();
expect(discoveryValue).toContain("/.well-known/openid-configuration");
});
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The E2E test verifies that endpoints are displayed but doesn't test the copy functionality. Consider adding a test case that clicks the copy buttons and verifies the copied state (Check icon) appears, to ensure the interactive features work correctly.

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +31
const handleCopy = (text: string, key: string) => {
navigator.clipboard.writeText(text);
setCopied(key);
setTimeout(() => setCopied(null), 2000);
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handleCopy function uses navigator.clipboard.writeText without error handling. This can fail in non-secure contexts (non-HTTPS) or when clipboard permissions are denied. Consider wrapping the clipboard operation in a try-catch block and providing user feedback if the operation fails.

Suggested change
const handleCopy = (text: string, key: string) => {
navigator.clipboard.writeText(text);
setCopied(key);
setTimeout(() => setCopied(null), 2000);
const handleCopy = async (text: string, key: string) => {
if (!navigator?.clipboard?.writeText) {
window.alert("Copy to clipboard is not supported in this browser.");
return;
}
try {
await navigator.clipboard.writeText(text);
setCopied(key);
setTimeout(() => setCopied(null), 2000);
} catch (error) {
console.error("Failed to copy to clipboard:", error);
window.alert("Failed to copy to clipboard. Please copy the text manually.");
}

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +76
<Button
type="button"
variant="outline"
size="icon"
data-testid={`copy-${key}`}
onClick={() => handleCopy(value, key)}
>
{copied === key ? (
<Check className="size-4" />
) : (
<Copy className="size-4" />
)}
</Button>
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copy buttons lack accessible labels. Screen reader users won't know what these buttons do. Add an aria-label attribute to the Button components that describes what will be copied, for example: aria-label={Copy ${label}}.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +19
const config = getOpenIDConfiguration();

Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getOpenIDConfiguration function is called without any error handling. If the OAUTH_ISSUER_URL environment variable is not set, this will result in an undefined issuer value that could cause runtime errors. While the page is a Server Component and should fail at build/startup time, consider adding validation to provide a clearer error message for misconfiguration.

Suggested change
const config = getOpenIDConfiguration();
let config;
try {
config = getOpenIDConfiguration();
} catch (error) {
const message =
error instanceof Error ? error.message : String(error);
throw new Error(
`Failed to load OpenID configuration. Ensure the OAUTH_ISSUER_URL environment variable is set correctly. Original error: ${message}`,
);
}
if (!config || !config.issuer) {
throw new Error(
"Invalid OpenID configuration: missing issuer. Please ensure the OAUTH_ISSUER_URL environment variable is set.",
);
}

Copilot uses AI. Check for mistakes.
@sirily11 sirily11 enabled auto-merge (squash) January 18, 2026 08:44
@sirily11 sirily11 merged commit 7f97484 into main Jan 18, 2026
4 checks passed
@sirily11 sirily11 deleted the url branch January 18, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants