Connexion Apple retirée (compte Apple Developer payant) ; le guide d'installation iPhone reste
deploy / deploy (push) Successful in 58s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
Claude committed 2026-12-02 09:48:01 +00:00
1 parent 673214304b
commit a907f829f1
23 files changed
+24 -136

No files matched your search

+6 -32
View File
@@ -3,7 +3,7 @@ import { LanguageSelect } from '../i18n/react'
import { Eye, EyeOff, Loader2 } from 'lucide-react'
import { useEffect, useState, type FormEvent, type ReactNode } from 'react'
import { useBackToClose } from '../lib/backNav'
import { oauthProviders, PASSWORD_MIN, requestPasswordReset, signIn, signInWithProvider, signOut, signUp, updatePassword, verifyTotp, type OAuthProvider } from '../lib/cloud/auth'
import { PASSWORD_MIN, requestPasswordReset, signIn, signInWithGoogle, signOut, signUp, updatePassword, verifyTotp } from '../lib/cloud/auth'
import { USERNAME_RE } from '../lib/cloud/social'
import { cx } from '../lib/utils'
import { RANDOM_USERNAME } from './social/WelcomeProfile'
@@ -78,17 +78,7 @@ export default function AuthScreen({
const cleanUsername = username.trim().replace(/^@/, '').toLowerCase()
const usernameOk = USERNAME_RE.test(cleanUsername) && !RANDOM_USERNAME.test(cleanUsername)
// « Continuer avec Apple » : affiché seulement une fois Apple activé dans Supabase
const [appleOn, setAppleOn] = useState(false)
useEffect(() => {
let alive = true
void oauthProviders().then((p) => alive && setAppleOn(!!p.apple))
return () => {
alive = false
}
}, [])
// Retour arrière depuis Google ou Apple (page restaurée du cache) : les boutons ne restent pas bloqués
// Retour arrière depuis Google (page restaurée du cache) : les boutons ne restent pas bloqués
useEffect(() => {
const onShow = (e: PageTransitionEvent) => {
if (e.persisted) setBusy(false)
@@ -103,12 +93,12 @@ export default function AuthScreen({
setInfo(undefined)
}
const oauth = async (provider: OAuthProvider) => {
const google = async () => {
setError(undefined)
setInfo(undefined)
setBusy(true)
try {
await signInWithProvider(provider)
await signInWithGoogle()
} catch (err) {
setError((err as Error).message)
setBusy(false)
@@ -163,16 +153,9 @@ export default function AuthScreen({
{mode !== 'forgot' && (
<>
<button type="button" onClick={() => oauth('google')} disabled={busy} className="btn btn-ghost w-full py-3">
<button type="button" onClick={google} disabled={busy} className="btn btn-ghost w-full py-3">
{t('auth.google')}
</button>
{appleOn && (
// Bouton Apple : logo et libellé imposés par Apple, même taille que le bouton Google
<button type="button" onClick={() => oauth('apple')} disabled={busy} className="btn mt-2 w-full bg-ink py-3 text-bg">
<AppleLogo />
{t('auth.apple')}
</button>
)}
<div className="my-5 flex items-center gap-3 text-xs text-ink-3">
<span className="h-px flex-1 bg-line" />
{t('auth.or')}
@@ -237,7 +220,7 @@ export default function AuthScreen({
</p>
)}
{/* Acceptation des conditions, avant de créer un compte (aussi valable pour Google et Apple) */}
{/* Acceptation des conditions, avant de créer un compte (aussi valable pour « Continuer avec Google ») */}
{mode !== 'forgot' && (
<p className="text-center text-xs leading-relaxed text-ink-3">
{t('auth.consent')}{' '}
@@ -397,12 +380,3 @@ export function LegalLinks() {
</nav>
)
}
/** Logo Apple (bouton « Continuer avec Apple »), à la couleur du texte. */
function AppleLogo() {
return (
<svg viewBox="0 0 170 170" width="17" height="17" fill="currentColor" aria-hidden="true">
<path d="M150.37 130.25c-2.45 5.66-5.35 10.87-8.71 15.66-4.58 6.53-8.33 11.05-11.22 13.56-4.48 4.12-9.28 6.23-14.42 6.35-3.69 0-8.14-1.05-13.32-3.18-5.2-2.12-9.97-3.17-14.34-3.17-4.58 0-9.49 1.05-14.75 3.17-5.26 2.13-9.5 3.24-12.74 3.35-4.93.21-9.84-1.96-14.75-6.52-3.13-2.73-7.05-7.41-11.74-14.04-5.03-7.08-9.17-15.29-12.41-24.65-3.47-10.11-5.21-19.9-5.21-29.38 0-10.86 2.35-20.22 7.05-28.07 3.69-6.3 8.61-11.28 14.76-14.93s12.79-5.51 19.95-5.63c3.92 0 9.05 1.21 15.43 3.59 6.36 2.39 10.45 3.6 12.24 3.6 1.34 0 5.88-1.42 13.57-4.24 7.28-2.62 13.42-3.7 18.45-3.28 13.63 1.1 23.87 6.47 30.68 16.15-12.19 7.39-18.22 17.73-18.1 31 .11 10.34 3.86 18.94 11.23 25.77 3.34 3.17 7.07 5.62 11.22 7.36-.9 2.61-1.85 5.11-2.86 7.51zM119.11 7.24c0 8.1-2.96 15.67-8.86 22.67-7.12 8.32-15.73 13.13-25.07 12.37-.12-.97-.19-1.99-.19-3.07 0-7.78 3.39-16.1 9.4-22.91 3-3.45 6.82-6.31 11.45-8.6 4.62-2.25 8.99-3.5 13.1-3.71.12 1.08.17 2.17.17 3.24z" />
</svg>
)
}
-2
View File
@@ -1187,8 +1187,6 @@ const dict: Translations = {
"install.step1": "اضغط على زر المشاركة (المربع الذي فيه سهم للأعلى). في أجهزة iPhone الحديثة تجده في القائمة «…».",
"install.step2": "اختر «إضافة إلى الشاشة الرئيسية».",
"install.step3": "اضغط «إضافة»: ستظهر أيقونة Bobinoo بجانب تطبيقاتك الأخرى.",
"auth.apple": "المتابعة باستخدام Apple",
"auth.err.apple": "تعذّر تسجيل الدخول باستخدام Apple. حاول مرة أخرى.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "Tippe auf die Teilen-Taste (das Quadrat mit dem Pfeil nach oben). Auf neueren iPhones findest du sie im Menü „…“.",
"install.step2": "Wähle „Zum Home-Bildschirm“.",
"install.step3": "Tippe auf „Hinzufügen“: Das Bobinoo-Symbol erscheint bei deinen anderen Apps.",
"auth.apple": "Mit Apple fortfahren",
"auth.err.apple": "Die Anmeldung mit Apple ist fehlgeschlagen. Versuch es erneut.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "Tap the Share button (the square with an arrow pointing up). On recent iPhones, it’s in the “…” menu.",
"install.step2": "Choose “Add to Home Screen”.",
"install.step3": "Tap “Add”: the Bobinoo icon appears with your other apps.",
"auth.apple": "Continue with Apple",
"auth.err.apple": "Sign in with Apple failed. Try again.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "Toca el botón Compartir (el cuadrado con una flecha hacia arriba). En los iPhone más recientes está en el menú «…».",
"install.step2": "Elige «Añadir a pantalla de inicio».",
"install.step3": "Toca «Añadir»: el icono de Bobinoo aparecerá junto a tus otras apps.",
"auth.apple": "Continuar con Apple",
"auth.err.apple": "No se pudo iniciar sesión con Apple. Inténtalo de nuevo.",
}
export default dict
-2
View File
@@ -1040,8 +1040,6 @@ const dict = {
"install.step1": "Touche le bouton Partager (le carré avec une flèche vers le haut). Sur les derniers iPhone, il se trouve dans le menu « … ».",
"install.step2": "Choisis « Sur l'écran d'accueil ».",
"install.step3": "Touche « Ajouter » : l'icône Bobinoo apparaît avec tes autres apps.",
"auth.apple": "Continuer avec Apple",
"auth.err.apple": "La connexion avec Apple a échoué. Réessaie.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "शेयर बटन (ऊपर की ओर तीर वाला चौकोर) पर टैप करें। नए iPhone में यह “…” मेन्यू में होता है।",
"install.step2": "“होम स्क्रीन में जोड़ें” चुनें।",
"install.step3": "“जोड़ें” पर टैप करें: Bobinoo का आइकन आपके दूसरे ऐप्स के साथ दिखेगा।",
"auth.apple": "Apple के साथ जारी रखें",
"auth.err.apple": "Apple से साइन इन नहीं हो सका। फिर से कोशिश करें।",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "Ketuk tombol Bagikan (kotak dengan panah ke atas). Di iPhone terbaru, tombol ini ada di menu “…”.",
"install.step2": "Pilih “Tambah ke Layar Utama”.",
"install.step3": "Ketuk “Tambah”: ikon Bobinoo muncul bersama app lainnya.",
"auth.apple": "Lanjutkan dengan Apple",
"auth.err.apple": "Gagal masuk dengan Apple. Coba lagi.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "Tocca il pulsante Condividi (il quadrato con la freccia verso l’alto). Sugli iPhone più recenti si trova nel menu «…».",
"install.step2": "Scegli «Aggiungi alla schermata Home».",
"install.step3": "Tocca «Aggiungi»: l’icona di Bobinoo comparirà insieme alle altre app.",
"auth.apple": "Continua con Apple",
"auth.err.apple": "Accesso con Apple non riuscito. Riprova.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "共有ボタン(上向き矢印のついた四角)をタップします。最近の iPhone では「…」メニューの中にあります。",
"install.step2": "「ホーム画面に追加」を選びます。",
"install.step3": "「追加」をタップすると、ほかのアプリと並んで Bobinoo のアイコンが表示されます。",
"auth.apple": "Apple で続ける",
"auth.err.apple": "Apple でのサインインに失敗しました。もう一度お試しください。",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "공유 버튼(위쪽 화살표가 있는 네모)을 탭하세요. 최신 iPhone에서는 '…' 메뉴 안에 있어요.",
"install.step2": "'홈 화면에 추가'를 선택하세요.",
"install.step3": "'추가'를 탭하면 다른 앱들 사이에 Bobinoo 아이콘이 나타나요.",
"auth.apple": "Apple로 계속하기",
"auth.err.apple": "Apple 로그인에 실패했어요. 다시 시도해 주세요.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "Tik op de deelknop (het vierkant met een pijl omhoog). Op nieuwere iPhones staat die in het menu ‘…’.",
"install.step2": "Kies ‘Zet op beginscherm’.",
"install.step3": "Tik op ‘Voeg toe’: het Bobinoo-icoon verschijnt tussen je andere apps.",
"auth.apple": "Doorgaan met Apple",
"auth.err.apple": "Inloggen met Apple is mislukt. Probeer het opnieuw.",
}
export default dict
-2
View File
@@ -1136,8 +1136,6 @@ const dict: Translations = {
"install.step1": "Stuknij przycisk Udostępnij (kwadrat ze strzałką w górę). W nowszych iPhone’ach znajdziesz go w menu „…”.",
"install.step2": "Wybierz „Do ekranu początkowego”.",
"install.step3": "Stuknij „Dodaj”: ikona Bobinoo pojawi się obok innych aplikacji.",
"auth.apple": "Kontynuuj z Apple",
"auth.err.apple": "Logowanie przez Apple nie powiodło się. Spróbuj ponownie.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "Toque no botão Compartilhar (o quadrado com uma seta para cima). Nos iPhones mais recentes, ele fica no menu “…”.",
"install.step2": "Escolha “Adicionar à Tela de Início”.",
"install.step3": "Toque em “Adicionar”: o ícone do Bobinoo aparece junto com seus outros apps.",
"auth.apple": "Continuar com a Apple",
"auth.err.apple": "Não foi possível entrar com a Apple. Tente de novo.",
}
export default dict
-2
View File
@@ -1136,8 +1136,6 @@ const dict: Translations = {
"install.step1": "Нажми кнопку «Поделиться» (квадрат со стрелкой вверх). На новых iPhone она в меню «…».",
"install.step2": "Выбери «На экран „Домой“».",
"install.step3": "Нажми «Добавить»: значок Bobinoo появится рядом с другими приложениями.",
"auth.apple": "Продолжить с Apple",
"auth.err.apple": "Не удалось войти через Apple. Попробуй ещё раз.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "แตะปุ่มแชร์ (สี่เหลี่ยมที่มีลูกศรชี้ขึ้น) ใน iPhone รุ่นใหม่ ปุ่มนี้อยู่ในเมนู “…”",
"install.step2": "เลือก “เพิ่มไปยังหน้าจอโฮม”",
"install.step3": "แตะ “เพิ่ม” แล้วไอคอน Bobinoo จะปรากฏพร้อมแอปอื่นๆ ของคุณ",
"auth.apple": "ดำเนินการต่อด้วย Apple",
"auth.err.apple": "ลงชื่อเข้าใช้ด้วย Apple ไม่สำเร็จ ลองอีกครั้ง",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "Paylaş düğmesine dokun (yukarı ok olan kare). Yeni iPhone’larda “…” menüsündedir.",
"install.step2": "“Ana Ekrana Ekle”yi seç.",
"install.step3": "“Ekle”ye dokun: Bobinoo simgesi diğer uygulamalarının yanında görünür.",
"auth.apple": "Apple ile devam et",
"auth.err.apple": "Apple ile giriş başarısız oldu. Tekrar dene.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "Chạm vào nút Chia sẻ (hình vuông có mũi tên hướng lên). Trên các iPhone mới, nút này nằm trong menu “…”.",
"install.step2": "Chọn “Thêm vào MH chính”.",
"install.step3": "Chạm “Thêm”: biểu tượng Bobinoo sẽ xuất hiện cùng các app khác của bạn.",
"auth.apple": "Tiếp tục với Apple",
"auth.err.apple": "Đăng nhập bằng Apple không thành công. Hãy thử lại.",
}
export default dict
-2
View File
@@ -1038,8 +1038,6 @@ const dict: Translations = {
"install.step1": "轻点“分享”按钮(带向上箭头的方框)。在较新的 iPhone 上,它位于“…”菜单中。",
"install.step2": "选择“添加到主屏幕”。",
"install.step3": "轻点“添加”:Bobinoo 图标会出现在你的其他 App 旁边。",
"auth.apple": "通过 Apple 继续",
"auth.err.apple": "使用 Apple 登录失败,请重试。",
}
export default dict
+13 -34
View File
@@ -226,26 +226,24 @@ export async function signOut(): Promise<void> {
}
}
// ───────────────────────── Connexion avec Google ou Apple (OAuth + PKCE) ─────────────────────────
// Le service renvoie vers l'app avec un code à usage unique (?code=…) que seul cet appareil peut échanger,
// ───────────────────────────── Connexion avec Google (OAuth + PKCE) ─────────────────────────────
// Google renvoie vers l'app avec un code à usage unique (?code=…) que seul cet appareil peut échanger,
// grâce au « vérificateur » gardé ici le temps de l'aller-retour. Aucun jeton ne passe dans l'adresse.
export type OAuthProvider = 'google' | 'apple'
const VERIFIER_KEY = 'azuucine:pkce'
const b64url = (bytes: Uint8Array) => btoa(String.fromCharCode(...bytes)).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
export async function signInWithProvider(provider: OAuthProvider): Promise<void> {
export async function signInWithGoogle(): Promise<void> {
const verifier = b64url(crypto.getRandomValues(new Uint8Array(48)))
const challenge = b64url(new Uint8Array(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier))))
try {
localStorage.setItem(VERIFIER_KEY, JSON.stringify({ verifier, at: Date.now(), provider }))
localStorage.setItem(VERIFIER_KEY, JSON.stringify({ verifier, at: Date.now() }))
} catch {
throw new AuthError(t('auth.err.storage'))
}
const params = new URLSearchParams({
provider,
provider: 'google',
redirect_to: appUrl(),
code_challenge: challenge,
code_challenge_method: 's256',
@@ -253,38 +251,20 @@ export async function signInWithProvider(provider: OAuthProvider): Promise<void>
location.assign(`${SUPABASE_URL}/auth/v1/authorize?${params}`)
}
let providers: Promise<Partial<Record<OAuthProvider, boolean>>> | undefined
/**
* Fournisseurs de connexion activés dans Supabase (Authentication → Providers). Le bouton Apple n'apparaît
* qu'une fois Apple configuré là-bas : rien à redéployer ce jour-là. Hors ligne ou erreur : aucun.
*/
export function oauthProviders(): Promise<Partial<Record<OAuthProvider, boolean>>> {
providers ??= withTimeout((signal) =>
fetch(`${SUPABASE_URL}/auth/v1/settings`, { headers: { apikey: SUPABASE_ANON_KEY }, credentials: 'omit', referrerPolicy: 'no-referrer', signal }),
)
.then((res): Promise<{ external?: Record<string, unknown> }> => (res.ok ? res.json() : Promise.resolve({})))
.then((d) => ({ google: d.external?.google === true, apple: d.external?.apple === true }))
.catch(() => {
providers = undefined // nouvel essai à la prochaine ouverture
return {}
})
return providers
}
/** Vérificateur gardé pendant l'aller-retour vers Google ou Apple (null s'il n'y en a pas). */
function readVerifier(): { verifier?: unknown; at?: unknown; provider?: unknown } | null {
/** Vérificateur gardé pendant l'aller-retour vers Google (null s'il n'y en a pas). */
function readVerifier(): { verifier?: unknown; at?: unknown } | null {
try {
const raw = localStorage.getItem(VERIFIER_KEY)
const parsed: unknown = raw ? JSON.parse(raw) : null
return parsed && typeof parsed === 'object' ? (parsed as { verifier?: unknown; at?: unknown; provider?: unknown }) : null
return parsed && typeof parsed === 'object' ? (parsed as { verifier?: unknown; at?: unknown }) : null
} catch {
return null
}
}
/**
* Retour de Google ou d'Apple : adresse avec ?code=… (ou ?error=…), seulement si une connexion a été lancée
* depuis cet appareil (vérificateur présent). Une autre adresse avec ?code= n'est pas un retour de connexion.
* Retour de Google : adresse avec ?code=… (ou ?error=…), seulement si une connexion Google a été lancée
* depuis cet appareil (vérificateur présent) — une autre adresse avec ?code= n'est pas un retour de Google.
*/
export const hasOAuthRedirect = () => /[?&](code|error)=/.test(location.search) && readVerifier() !== null
@@ -298,18 +278,17 @@ async function consumeOAuthRedirect(): Promise<{ error?: string }> {
verifier: typeof stored?.verifier === 'string' ? stored.verifier : undefined,
at: typeof stored?.at === 'number' ? stored.at : undefined,
}
const failed = t(stored?.provider === 'apple' ? 'auth.err.apple' : 'auth.err.google')
try {
localStorage.removeItem(VERIFIER_KEY)
} catch {
/* ignore */
}
if (oauthError) return { error: failed }
if (oauthError) return { error: t('auth.err.google') }
// Vérificateur absent ou trop vieux (> 10 min) : on ne tente rien
if (!/^[A-Za-z0-9_-]{43,128}$/.test(saved.verifier ?? '') || !saved.at || Date.now() - saved.at > 600_000) {
return { error: failed }
return { error: t('auth.err.google') }
}
if (!/^[A-Za-z0-9_-]{8,256}$/.test(code)) return { error: failed }
if (!/^[A-Za-z0-9_-]{8,256}$/.test(code)) return { error: t('auth.err.google') }
try {
const data = await gotrue('/token?grant_type=pkce', { body: { auth_code: code, code_verifier: saved.verifier } })
const s = toSession(data)