feat: hide Google sign-in in embedded WebView (DApps browser)

Google blocks OAuth in WebViews (disallowed_useragent policy).
Detect WebView and hide the Google button, users in DApps browser
use email/password instead. Google sign-in still works in real
browsers (Chrome, Safari, etc).
This commit is contained in:
2026-03-15 05:30:17 +03:00
parent 918ce406e0
commit c91d7f5d57
+7
View File
@@ -24,6 +24,11 @@ const Login: React.FC = () => {
const [error, setError] = useState('');
const [loading, setLoading] = useState(false);
// Detect embedded WebView (DApps browser) - hide Google OAuth there
const isWebView = /wv|WebView/i.test(navigator.userAgent) ||
(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)) ||
(/Android.*Version\/[\d.]+.*Chrome\/[\d.]+ Mobile/i.test(navigator.userAgent) && !/Chrome\/[\d.]+ Mobile Safari/i.test(navigator.userAgent));
const [loginData, setLoginData] = useState({
email: '',
password: ''
@@ -382,6 +387,7 @@ const Login: React.FC = () => {
</div>
<div className="space-y-3">
{!isWebView && (
<Button
variant="outline"
className="w-full border-gray-700 bg-gray-800 hover:bg-gray-700 text-white"
@@ -396,6 +402,7 @@ const Login: React.FC = () => {
</svg>
{t('login.googleSignIn', 'Continue with Google')}
</Button>
)}
<Button
variant="outline"