PageSourceSearch

https://www.cyborux.com/assets/AuthCallback-DQEu0s2u.js

js cyborux.com collected 2026-10-07 18:56:21 UTC 3,086 bytes, 2 lines download raw bytes

1import{j as r}from"./query-vendor-B_C8B5sB.js";import{r as c,u as k,e as w}from"./react-vendor-B23zaUj-.js";import{u as j,at as N,bF as E,au as g,L as f}from"./index-I1ewQokE.js";import{C as v,b as A,c as S,d as _,a as y}from"./card-D3er64nc.js";import{A as L,a as P}from"./alert-ZrDf5Rai.js";import{C as T}from"./circle-check-yb-mqbCI.js";import{C as D}from"./circle-alert-CmWFjub3.js";import"./ui-vendor-CYC2HZ_g.js";import"./supabase-vendor-BeaikSuM.js";function F(s){if(!(s instanceof Error))return"unknown";const e=s.message.toLowerCase();return e.includes("expired")?"token_expired":e.includes("invalid")?"invalid_token":e.includes("no session")||e.includes("no authentication")?"no_session":"unknown"}function G(){const{t:s}=j("common"),[e,i]=c.useState("loading"),[p,t]=c.useState(s("authCallback.processing")),l=k(),u=w(),{completeSignIn:x}=N();c.useEffect(()=>{C()},[]);const C=async()=>{try{const a=new URLSearchParams(u.hash.substring(1)),n=new URLSearchParams(u.search),d=a.get("error")||n.get("error"),b=a.get("error_description")||n.get("error_description");if(d)throw new Error(b||`Authentication failed: ${d}`);t(s("authCallback.verifying"));const h=n.get("code");if(!h)throw new Error("No authentication token found");const{data:o,error:m}=await E.auth.exchangeCodeForSession(h);if(m)throw m;if(!(o!=null&&o.session))throw new Error("No session returned from authentication");t(s("authCallback.settingUpSession")),await x(o.session),i("success"),t(s("authCallback.success")),g("signin_succeeded",{method:"google_oauth"}),setTimeout(()=>{l("/home",{replace:!0})},1500)}catch(a){console.error("Auth callback error:",a),i("error"),t(a instanceof Error?a.message:s("authCallback.errorFallback")),g("signin_failed",{method:"google_oauth",error_type:F(a)}),setTimeout(()=>{l("/signin",{replace:!0})},3e3)}};return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:r.jsxs(v,{className:"w-full max-w-md bg-white dark:bg-slate-800 border-slate-200 dark:border-slate-700",children:[r.jsxs(A,{className:"text-center",children:[r.jsxs(S,{className:"text-2xl",children:[e==="loading"&&s("authCallback.titleLoading"),e==="success"&&s("authCallback.titleSuccess"),e==="error"&&s("authCallback.titleError")]}),r.jsxs(_,{children:[e==="loading"&&s("authCallback.descLoading"),e==="success"&&s("authCallback.descSuccess"),e==="error"&&s("authCallback.descError")]})]}),r.jsxs(y,{className:"space-y-4",children:[r.jsxs(L,{variant:e==="error"?"destructive":"default",children:[e==="loading"&&r.jsx(f,{className:"h-4 w-4 animate-spin"}),e==="success"&&r.jsx(T,{className:"h-4 w-4 text-green-600"}),e==="error"&&r.jsx(D,{className:"h-4 w-4"}),r.jsx(P,{className:"ml-2",children:p})]}),e==="loading"&&r.jsx("div",{className:"flex justify-center py-4",children:r.jsx(f,{className:"h-8 w-8 animate-spin text-primary"})}),e==="error"&&r.jsx("div",{className:"text-center text-sm text-muted-foreground",children:r.jsx("p",{children:s("authCallback.redirecting")})})]})]})})}export{G as default};
2//# sourceMappingURL=AuthCallback-DQEu0s2u.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.