Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: external auth device flow, check both queries for errors#12367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 6 commits intomainfromstevenmasley/idp_429_fail
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletionssite/src/pages/ExternalAuthPage/ExternalAuthPage.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,6 +53,8 @@ const ExternalAuthPage: FC = () => {
if (isAxiosError(exchangeExternalAuthDeviceQuery.failureReason)) {
deviceExchangeError =
exchangeExternalAuthDeviceQuery.failureReason.response?.data;
} else if (isAxiosError(externalAuthDeviceQuery.failureReason)) {
deviceExchangeError = externalAuthDeviceQuery.failureReason.response?.data;
}

if (
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,6 +49,27 @@ DeviceUnauthenticated.args = {
},
};

export const Device429Error = Template.bind({});
Device429Error.args = {
externalAuth: {
display_name: "GitHub",
authenticated: false,
device: true,
installations: [],
app_install_url: "",
app_installable: false,
},
// This is intentionally undefined.
// If we get a 429 on the first /device call, then this
// is undefined with a 429 error.
externalAuthDevice: undefined,
deviceExchangeError: {
message: "Failed to authorize device.",
detail:
"rate limit hit, unable to authorize device. please try again later",
},
};

export const DeviceUnauthenticatedError = Template.bind({});
DeviceUnauthenticatedError.args = {
externalAuth: {
Expand Down
15 changes: 12 additions & 3 deletionssite/src/pages/ExternalAuthPage/ExternalAuthPageView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
import { type Interpolation, type Theme } from "@emotion/react";
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
import RefreshIcon from "@mui/icons-material/Refresh";
import AlertTitle from "@mui/material/AlertTitle";
import CircularProgress from "@mui/material/CircularProgress";
import Link from "@mui/material/Link";
import Tooltip from "@mui/material/Tooltip";
import type { ApiErrorResponse } from "api/errors";
import type { ExternalAuth, ExternalAuthDevice } from "api/typesGenerated";
import { Alert } from "components/Alert/Alert";
import { Alert, AlertDetail } from "components/Alert/Alert";
import { Avatar } from "components/Avatar/Avatar";
import { CopyButton } from "components/CopyButton/CopyButton";
import { SignInLayout } from "components/SignInLayout/SignInLayout";
Expand DownExpand Up@@ -173,14 +174,22 @@ const GitDeviceAuth: FC<GitDeviceAuthProps> = ({
default:
status = (
<Alert severity="error">
An unknown error occurred. Please try again:{" "}
{deviceExchangeError.message}
<AlertTitle>{deviceExchangeError.message}</AlertTitle>
{deviceExchangeError.detail && (
<AlertDetail>{deviceExchangeError.detail}</AlertDetail>
)}
</Alert>
);
break;
}
}

// If the error comes from the `externalAuthDevice` query,
// we cannot even display the user_code.
if (deviceExchangeError && !externalAuthDevice) {
return <div>{status}</div>;
}

if (!externalAuthDevice) {
return <CircularProgress />;
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp