import { Link } from "react-router"; import { Translate, useHandleAuthCallback, useTranslate } from "ra-core"; import { CircleAlert, LockIcon } from "lucide-react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Loading } from "@/components/admin/loading"; /** * A standalone page to be used as a redirection target for external authentication services (e.g. OAuth) * * It displays a loading indicator while processing the authentication response, * then redirects to the admin app or shows an error message if authentication fails. * * @see {@link https://marmelab.com/shadcn-admin-kit/docs/security/ Security documentation} * * @example * import { Admin } from "@/components/admin"; * import MyAuthCallbackPage from './MyAuthCallbackPage'; * const App = () => ( * * ... * * ); */ export const AuthCallback = () => { const { error } = useHandleAuthCallback(); if (error) { return ( ); } return ; }; export interface AuthErrorProps { className?: string; title?: string; message?: string; } /** * Authentication error page displayed when authentication fails. * * @see {@link https://marmelab.com/shadcn-admin-kit/docs/security/ Security documentation} * * @example * import { Admin } from "@/components/admin"; * import MyAuthErrorPage from './MyAuthErrorPage'; * const App = () => ( * * ... * * ); */ export const AuthError = (props: AuthErrorProps) => { const { className, title = "ra.page.error", message = "ra.message.auth_error", ...rest } = props; const translate = useTranslate(); return (

{translate(message, { _: message })}

); };