diff --git a/apps/web/src/app.js b/apps/web/src/app.js index 623bf1b..dbafba4 100644 --- a/apps/web/src/app.js +++ b/apps/web/src/app.js @@ -181,7 +181,8 @@ app.get('/auth/coinpay/callback', async (c) => { let pass; try { ({ subject, pass } = await auth.coinPayIdentityFromCode(query.code, pending.codeVerifier)); - } catch { + } catch (err) { + console.error(`[coinpay] code exchange failed: ${err?.message ?? err}`); return c.redirect(pending.userId ? '/app/account?coinpay=failed' : signInError('coinpay-failed'), 302); } diff --git a/apps/web/src/auth.js b/apps/web/src/auth.js index 03bb853..bb866d7 100644 --- a/apps/web/src/auth.js +++ b/apps/web/src/auth.js @@ -181,7 +181,7 @@ export async function coinPayIdentityFromCode(code, codeVerifier) { }); const tokens = await tokenResponse.json().catch(() => null); if (!tokenResponse.ok || typeof tokens?.access_token !== 'string' || !tokens.access_token) - throw new Error('CoinPay sign-in failed'); + throw new Error(`CoinPay sign-in failed: ${tokenResponse.status} ${tokens?.error ?? ''} ${tokens?.error_description ?? ''}`.trim()); const userResponse = await fetch(config.coinpayOAuth.userInfoUrl, { headers: { authorization: `Bearer ${tokens.access_token}`, accept: 'application/json' },