Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions backend/chainlit/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ async def oauth_callback(

if error:
logger.warning("OAuth provider %s returned error: %s", provider_id, error)
return _get_oauth_redirect_error(request, "oauthSignin")
error_key = "oauthAccessDenied" if error == "access_denied" else "oauthSignin"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: OAuth provider-error mapping is now duplicated in both callback handlers, which can drift if one flow is updated later and the other is missed. A shared helper for mapping provider errors to login error keys would keep both redirect variants consistent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/chainlit/server.py, line 674:

<comment>OAuth provider-error mapping is now duplicated in both callback handlers, which can drift if one flow is updated later and the other is missed. A shared helper for mapping provider errors to login error keys would keep both redirect variants consistent.</comment>

<file context>
@@ -671,7 +671,8 @@ async def oauth_callback(
     if error:
         logger.warning("OAuth provider %s returned error: %s", provider_id, error)
-        return _get_oauth_redirect_error(request, "oauthSignin")
+        error_key = "oauthAccessDenied" if error == "access_denied" else "oauthSignin"
+        return _get_oauth_redirect_error(request, error_key)
 
</file context>

return _get_oauth_redirect_error(request, error_key)

if not code or not state:
return _get_oauth_redirect_error(request, "oauthSignin")
Expand Down Expand Up @@ -736,7 +737,8 @@ async def oauth_azure_hf_callback(

if error:
logger.warning("OAuth provider %s returned error: %s", provider_id, error)
return _get_oauth_redirect_error(request, "oauthSignin", status_code=303)
error_key = "oauthAccessDenied" if error == "access_denied" else "oauthSignin"
return _get_oauth_redirect_error(request, error_key, status_code=303)

if not code:
return _get_oauth_redirect_error(request, "oauthSignin", status_code=303)
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/ar-SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "تعذر تسجيل الدخول",
"signin": "حاول تسجيل الدخول بحساب آخر",
"oauthSignin": "فشل تسجيل الدخول. يرجى المحاولة مرة أخرى، أو استخدام طريقة تسجيل دخول مختلفة.",
"oauthAccessDenied": "تم إلغاء تسجيل الدخول أو تم رفض الوصول. إذا كان هذا عن طريق الخطأ، يرجى المحاولة مرة أخرى.",
"redirectUriMismatch": "عنوان URI لإعادة التوجيه لا يتطابق مع تكوين تطبيق OAuth",
"oauthCallback": "حاول تسجيل الدخول بحساب آخر",
"oauthCreateAccount": "حاول تسجيل الدخول بحساب آخر",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "সাইন ইন করা সম্ভব হচ্ছে না",
"signin": "অন্য একটি অ্যাকাউন্ট দিয়ে সাইন ইন করার চেষ্টা করুন",
"oauthSignin": "সাইন ইন ব্যর্থ হয়েছে। আবার চেষ্টা করুন, অথবা অন্য একটি সাইন ইন পদ্ধতি ব্যবহার করুন।",
"oauthAccessDenied": "সাইন ইন বাতিল করা হয়েছে বা অ্যাক্সেস অস্বীকার করা হয়েছে। যদি এটি ভুলবশত হয়ে থাকে, অনুগ্রহ করে আবার চেষ্টা করুন।",
"redirectUriMismatch": "রিডাইরেক্ট URI ওআথ অ্যাপ কনফিগারেশনের সাথে মিলছে না",
"oauthCallback": "অন্য একটি অ্যাকাউন্ট দিয়ে সাইন ইন করার চেষ্টা করুন",
"oauthCreateAccount": "অন্য একটি অ্যাকাউন্ট দিয়ে সাইন ইন করার চেষ্টা করুন",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/da-DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "Kunne ikke logge ind",
"signin": "Prøv at logge ind med en anden konto",
"oauthSignin": "Log ind mislykkedes. Prøv igen, eller brug en anden loginmetode.",
"oauthAccessDenied": "Login blev annulleret, eller adgang blev nægtet. Hvis det var en fejl, så prøv igen.",
"redirectUriMismatch": "Omdirigerings-URI'en matcher ikke oauth-app konfigurationen",
"oauthCallback": "Prøv at logge ind med en anden konto",
"oauthCreateAccount": "Prøv at logge ind med en anden konto",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "Anmeldung fehlgeschlagen",
"signin": "Versuche dich mit einem anderen Konto anzumelden",
"oauthSignin": "Anmeldung fehlgeschlagen. Bitte versuche es erneut oder verwende eine andere Anmeldemethode.",
"oauthAccessDenied": "Die Anmeldung wurde abgebrochen oder der Zugriff wurde verweigert. Falls dies ein Versehen war, versuchen Sie es bitte erneut.",
"redirectUriMismatch": "Der Redirect-URI stimmt nicht mit der Konfiguration der Oauth-Anwendung überein",
"oauthCallback": "Versuche dich mit einem anderen Konto anzumelden",
"oauthCreateAccount": "Versuche dich mit einem anderen Konto anzumelden",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/el-GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "Δεν είναι δυνατή η σύνδεση",
"signin": "Δοκιμάστε να συνδεθείτε με διαφορετικό λογαριασμό",
"oauthSignin": "Η σύνδεση απέτυχε. Παρακαλώ δοκιμάστε ξανά ή χρησιμοποιήστε διαφορετική μέθοδο σύνδεσης.",
"oauthAccessDenied": "Η σύνδεση ακυρώθηκε ή η πρόσβαση απορρίφθηκε. Αν έγινε κατά λάθος, δοκιμάστε ξανά.",
"redirectUriMismatch": "Ο σύνδεσμος ανακατεύθυνσης δεν ταιριάζει με τη ρύθμιση της αυθεντικοποιήσης της εφαρμογής",
"oauthCallback": "Δοκιμάστε να συνδεθείτε με διαφορετικό λογαριασμό",
"oauthCreateAccount": "Δοκιμάστε να συνδεθείτε με διαφορετικό λογαριασμό",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "Unable to sign in",
"signin": "Try signing in with a different account",
"oauthSignin": "Sign in failed. Please try again, or use a different sign-in method.",
"oauthAccessDenied": "Sign in was cancelled or access was denied. If this was a mistake, please try again.",
"redirectUriMismatch": "The redirect URI is not matching the oauth app configuration",
"oauthCallback": "Try signing in with a different account",
"oauthCreateAccount": "Try signing in with a different account",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "No se pudo iniciar sesión",
"signin": "Intenta iniciar sesión con otra cuenta",
"oauthSignin": "Error al iniciar sesión. Por favor, inténtalo de nuevo o usa un método de inicio de sesión diferente.",
"oauthAccessDenied": "El inicio de sesión se canceló o se denegó el acceso. Si fue un error, vuelva a intentarlo.",
"redirectUriMismatch": "El URI de redirección no coincide con la configuración de la aplicación OAuth",
"oauthCallback": "Intenta iniciar sesión con otra cuenta",
"oauthCreateAccount": "Intenta iniciar sesión con otra cuenta",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "Impossible de se connecter",
"signin": "Essayez de vous connecter avec un autre compte",
"oauthSignin": "La connexion a échoué. Veuillez réessayer ou utiliser un autre mode de connexion.",
"oauthAccessDenied": "La connexion a été annulée ou l'accès a été refusé. Si c'est une erreur, veuillez réessayer.",
"redirectUriMismatch": "L'URI de redirection ne correspond pas à la configuration de l'application oauth",
"oauthCallback": "Essayez de vous connecter avec un autre compte",
"oauthCreateAccount": "Essayez de vous connecter avec un autre compte",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/gu.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "સાઇન ઇન કરી શકાયું નથી",
"signin": "અલગ એકાઉન્ટથી સાઇન ઇન કરવાનો પ્રયાસ કરો",
"oauthSignin": "સાઇન ઇન નિષ્ફળ ગઈ. કૃપા કરીને ફરી પ્રયાસ કરો, અથવા અલગ સાઇન ઇન પદ્ધતિનો ઉપયોગ કરો.",
"oauthAccessDenied": "સાઇન ઇન રદ કરવામાં આવ્યું અથવા ઍક્સેસ નકારવામાં આવી. જો આ ભૂલથી થયું હોય, તો કૃપા કરીને ફરી પ્રયાસ કરો.",
"redirectUriMismatch": "રીડાયરેક્ટ URI oauth ઍપ કન્ફિગરેશન સાથે મેળ ખાતો નથી",
"oauthCallback": "અલગ એકાઉન્ટથી સાઇન ઇન કરવાનો પ્રયાસ કરો",
"oauthCreateAccount": "અલગ એકાઉન્ટથી સાઇન ઇન કરવાનો પ્રયાસ કરો",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/he-IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "לא ניתן להתחבר",
"signin": "נסה להתחבר עם חשבון אחר",
"oauthSignin": "הכניסה נכשלה. אנא נסה שוב, או השתמש בשיטת כניסה אחרת.",
"oauthAccessDenied": "ההתחברות בוטלה או שהגישה נדחתה. אם זו הייתה טעות, אנא נסה שוב.",
"redirectUriMismatch": "כתובת ההפניה אינה תואמת את תצורת אפליקציית OAuth",
"oauthCallback": "נסה להתחבר עם חשבון אחר",
"oauthCreateAccount": "נסה להתחבר עם חשבון אחר",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "साइन इन करने में असमर्थ",
"signin": "किसी दूसरे खाते से साइन इन करने का प्रयास करें",
"oauthSignin": "साइन इन विफल हुआ। कृपया पुनः प्रयास करें, या कोई अन्य साइन इन विधि उपयोग करें।",
"oauthAccessDenied": "साइन इन रद्द कर दिया गया या एक्सेस अस्वीकार कर दिया गया। यदि यह गलती से हुआ है, तो कृपया पुनः प्रयास करें।",
"redirectUriMismatch": "रीडायरेक्ट URI oauth ऐप कॉन्फ़िगरेशन से मेल नहीं खा रहा",
"oauthCallback": "किसी दूसरे खाते से साइन इन करने का प्रयास करें",
"oauthCreateAccount": "किसी दूसरे खाते से साइन इन करने का प्रयास करें",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "Impossibile effettuare l'accesso",
"signin": "Prova ad accedere con un account diverso",
"oauthSignin": "Accesso non riuscito. Riprova o utilizza un metodo di accesso diverso.",
"oauthAccessDenied": "L'accesso è stato annullato o l'autorizzazione è stata negata. Se è stato un errore, riprova.",
"redirectUriMismatch": "L'URI di reindirizzamento non corrisponde alla configurazione dell'app OAuth",
"oauthCallback": "Prova ad accedere con un account diverso",
"oauthCreateAccount": "Prova ad accedere con un account diverso",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "サインインできません",
"signin": "別のアカウントでサインインしてください",
"oauthSignin": "サインインに失敗しました。もう一度お試しいただくか、別のサインイン方法をお使いください。",
"oauthAccessDenied": "サインインがキャンセルされたか、アクセスが拒否されました。誤りの場合は、もう一度お試しください。",
"redirectUriMismatch": "リダイレクトURIがOAuthアプリの設定と一致しません",
"oauthCallback": "別のアカウントでサインインしてください",
"oauthCreateAccount": "別のアカウントでサインインしてください",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/kn.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "ಸೈನ್ ಇನ್ ಮಾಡಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ",
"signin": "ಬೇರೆ ಖಾತೆಯೊಂದಿಗೆ ಸೈನ್ ಇನ್ ಮಾಡಲು ಪ್ರಯತ್ನಿಸಿ",
"oauthSignin": "ಸೈನ್ ಇನ್ ವಿಫಲವಾಗಿದೆ. ದಯವಿಟ್ಟು ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ, ಅಥವಾ ಬೇರೆ ಸೈನ್ ಇನ್ ವಿಧಾನ ಬಳಸಿ.",
"oauthAccessDenied": "ಸೈನ್ ಇನ್ ರದ್ದುಗೊಳಿಸಲಾಗಿದೆ ಅಥವಾ ಪ್ರವೇಶವನ್ನು ನಿರಾಕರಿಸಲಾಗಿದೆ. ಇದು ತಪ್ಪಾಗಿ ಆಗಿದ್ದರೆ, ದಯವಿಟ್ಟು ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ.",
"redirectUriMismatch": "ರೀಡೈರೆಕ್ಟ್ URI ಓಥ್ ಅಪ್ಲಿಕೇಶನ್ ಕಾನ್ಫಿಗರೇಶನ್‌ಗೆ ಹೊಂದಿಕೆಯಾಗುತ್ತಿಲ್ಲ",
"oauthCallback": "ಬೇರೆ ಖಾತೆಯೊಂದಿಗೆ ಸೈನ್ ಇನ್ ಮಾಡಲು ಪ್ರಯತ್ನಿಸಿ",
"oauthCreateAccount": "ಬೇರೆ ಖಾತೆಯೊಂದಿಗೆ ಸೈನ್ ಇನ್ ಮಾಡಲು ಪ್ರಯತ್ನಿಸಿ",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "로그인할 수 없습니다",
"signin": "다른 계정으로 로그인해보세요",
"oauthSignin": "로그인에 실패했습니다. 다시 시도하거나 다른 로그인 방법을 사용해 주세요.",
"oauthAccessDenied": "로그인이 취소되었거나 접근이 거부되었습니다. 실수였다면 다시 시도해 주세요.",
"redirectUriMismatch": "리다이렉트 URI가 OAuth 앱 설정과 일치하지 않습니다",
"oauthCallback": "다른 계정으로 로그인해보세요",
"oauthCreateAccount": "다른 계정으로 로그인해보세요",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/ml.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "സൈൻ ഇൻ ചെയ്യാൻ കഴിയുന്നില്ല",
"signin": "മറ്റൊരു അക്കൗണ്ട് ഉപയോഗിച്ച് സൈൻ ഇൻ ചെയ്യാൻ ശ്രമിക്കുക",
"oauthSignin": "സൈൻ ഇൻ പരാജയപ്പെട്ടു. ദയവായി വീണ്ടും ശ്രമിക്കുക, അല്ലെങ്കിൽ മറ്റൊരു സൈൻ ഇൻ രീതി ഉപയോഗിക്കുക.",
"oauthAccessDenied": "സൈൻ ഇൻ റദ്ദാക്കി അല്ലെങ്കിൽ ആക്സസ് നിരസിച്ചു. ഇത് അബദ്ധത്തിൽ സംഭവിച്ചതാണെങ്കിൽ, ദയവായി വീണ്ടും ശ്രമിക്കുക.",
"redirectUriMismatch": "റീഡയറക്ട് URI oauth ആപ്പ് കോൺഫിഗറേഷനുമായി പൊരുത്തപ്പെടുന്നില്ല",
"oauthCallback": "മറ്റൊരു അക്കൗണ്ട് ഉപയോഗിച്ച് സൈൻ ഇൻ ചെയ്യാൻ ശ്രമിക്കുക",
"oauthCreateAccount": "മറ്റൊരു അക്കൗണ്ട് ഉപയോഗിച്ച് സൈൻ ഇൻ ചെയ്യാൻ ശ്രമിക്കുക",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/mr.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "साइन इन करू शकत नाही",
"signin": "वेगळ्या खात्याने साइन इन करण्याचा प्रयत्न करा",
"oauthSignin": "साइन इन अयशस्वी झाले. कृपया पुन्हा प्रयत्न करा, किंवा वेगळी साइन इन पद्धत वापरा.",
"oauthAccessDenied": "साइन इन रद्द केले गेले किंवा प्रवेश नाकारला गेला. हे चुकून झाले असल्यास, कृपया पुन्हा प्रयत्न करा.",
"redirectUriMismatch": "रीडायरेक्ट URI ओथ अॅप कॉन्फिगरेशनशी जुळत नाही",
"oauthCallback": "वेगळ्या खात्याने साइन इन करण्याचा प्रयत्न करा",
"oauthCreateAccount": "वेगळ्या खात्याने साइन इन करण्याचा प्रयत्न करा",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "Kan niet inloggen",
"signin": "Probeer in te loggen met een ander account",
"oauthSignin": "Inloggen mislukt. Probeer het opnieuw of gebruik een andere aanmeldmethode.",
"oauthAccessDenied": "Het inloggen is geannuleerd of de toegang is geweigerd. Als dit een vergissing was, probeer het opnieuw.",
"redirectUriMismatch": "De redirect URI komt niet overeen met de oauth app configuratie",
"oauthCallback": "Probeer in te loggen met een ander account",
"oauthCreateAccount": "Probeer in te loggen met een ander account",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "Não foi possível iniciar sessão",
"signin": "Tente iniciar sessão com outra conta",
"oauthSignin": "Falha no início de sessão. Por favor, tente novamente ou utilize um método de início de sessão diferente.",
"oauthAccessDenied": "O in\u00edcio de sess\u00e3o foi cancelado ou o acesso foi negado. Se foi um engano, tente novamente.",
"redirectUriMismatch": "O URI de redirecionamento não corresponde à configuração da aplicação OAuth",
"oauthCallback": "Tente iniciar sessão com outra conta",
"oauthCreateAccount": "Tente iniciar sessão com outra conta",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/ta.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "உள்நுழைய முடியவில்லை",
"signin": "வேறு கணக்குடன் உள்நுழைய முயற்சிக்கவும்",
"oauthSignin": "உள்நுழைவு தோல்வியடைந்தது. மீண்டும் முயற்சிக்கவும், அல்லது வேறு உள்நுழைவு முறையைப் பயன்படுத்தவும்.",
"oauthAccessDenied": "உள்நுழைவு ரத்து செய்யப்பட்டது அல்லது அணுகல் மறுக்கப்பட்டது. இது தவறுதலாக நிகழ்ந்திருந்தால், மீண்டும் முயற்சிக்கவும்.",
"redirectUriMismatch": "திசைதிருப்பல் URI ஓஆத் பயன்பாட்டு கட்டமைப்புடன் பொருந்தவில்லை",
"oauthCallback": "வேறு கணக்குடன் உள்நுழைய முயற்சிக்கவும்",
"oauthCreateAccount": "வேறு கணக்குடன் உள்நுழைய முயற்சிக்கவும்",
Expand Down
1 change: 1 addition & 0 deletions backend/chainlit/translations/te.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "సైన్ ఇన్ చేయలేకపోయాము",
"signin": "వేరే ఖాతాతో సైన్ ఇన్ చేయడానికి ప్రయత్నించండి",
"oauthSignin": "సైన్ ఇన్ విఫలమైంది. దయచేసి మళ్ళీ ప్రయత్నించండి, లేదా వేరే సైన్ ఇన్ పద్ధతిని ఉపయోగించండి.",
"oauthAccessDenied": "సైన్ ఇన్ రద్దు చేయబడింది లేదా యాక్సెస్ నిరాకరించబడింది. ఇది పొరపాటున జరిగితే, దయచేసి మళ్లీ ప్రయత్నించండి.",
"redirectUriMismatch": "రీడైరెక్ట్ URI oauth యాప్ కాన్ఫిగరేషన్‌తో సరిపోలడం లేదు",
"oauthCallback": "వేరే ఖాతాతో సైన్ ఇన్ చేయడానికి ప్రయత్నించండి",
"oauthCreateAccount": "వేరే ఖాతాతో సైన్ ఇన్ చేయడానికి ప్రయత్నించండి",
Expand Down
Loading