aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.32k stars 246 forks source link

Google Login UI is always in Arabic [Flutter] #2052

Open mufayed opened 2 years ago

mufayed commented 2 years ago

Description

I got a problem, The users that are trying to log in via google, the google page is always in Arabic for them, so is there any way to change the language and make it default to English?

Amplify.Auth.signInWithWebUI(
      provider: AuthProvider.google,
          options: const CognitoSignInWithWebUIOptions(
              isPreferPrivateSession: true));

Categories

Steps to Reproduce

1- During testing on emulators got the problem 2- Checked the emulator's (ios and android) language but it's English with English region

Screenshots

Simulator Screen Shot - iPhone 13 - 2022-08-19 at 09 03 56 Simulator Screen Shot - iPhone 13 - 2022-08-19 at 09 04 30

Platforms

Android Device/Emulator API Level

No response

Environment

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.3, on macOS 12.4 21F79 darwin-arm, locale en-AE)                                                                                                  [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.70.1)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

• No issues found!

Dependencies

dependencies:
- amplify_auth_cognito 0.6.2 [amplify_auth_cognito_android amplify_auth_cognito_ios amplify_core aws_common collection flutter meta plugin_platform_interface]
- amplify_flutter 0.6.2 [amplify_core amplify_datastore_plugin_interface amplify_flutter_android amplify_flutter_ios aws_common collection flutter meta plugin_platform_interface]
- appsflyer_sdk 6.5.2+2 [flutter]
- connectivity_plus 2.3.5 [flutter connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows]
- country_picker 2.0.15 [flutter collection]
- cupertino_icons 1.0.5
- device_preview 1.1.0 [flutter flutter_localizations provider device_frame freezed_annotation json_annotation shared_preferences collection]
- dio 4.0.6 [http_parser path]
- dio_cache_interceptor 3.3.0 [dio uuid string_scanner]
- dio_cache_interceptor_hive_store 3.2.0 [dio_cache_interceptor hive]
- dots_indicator 2.1.0 [flutter]
- equatable 2.0.3 [collection meta]
- firebase_analytics 9.2.0 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_core 1.19.2 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_messaging 12.0.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_remote_config 2.0.13 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter]
- flotiq_openapi 1.0.0 [dio built_value built_collection]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_bloc 8.0.1 [flutter bloc provider]
- flutter_dotenv 5.0.2 [flutter]
- flutter_local_notifications 9.7.0 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
- flutter_svg 0.23.0+1 [flutter meta path_drawing vector_math xml]
- freezed 2.0.3+1 [analyzer build build_config collection meta source_gen freezed_annotation json_annotation]
- freezed_annotation 2.0.3 [collection json_annotation meta]
- get_it 7.2.0 [async collection]
- openapi 1.0.0 [dio built_value built_collection]
- raygun4flutter 1.2.1 [connectivity_plus device_info_plus flutter http intl json_annotation network_info_plus package_info_plus path_provider shared_preferences stack_trace uuid]
- rudder_sdk_flutter 1.2.0 [flutter logger intl]
- shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- sizer 2.0.15 [universal_io flutter]
- sso_oauth 0.0.1 [collection crypto http http_parser]
- webview_flutter 2.8.0 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview]

transitive dependencies:
- _fe_analyzer_shared 41.0.0 [meta]
- amplify_auth_cognito_android 0.6.2 [flutter]
- amplify_auth_cognito_ios 0.6.2 [amplify_core flutter]
- amplify_core 0.6.2 [aws_common collection flutter intl json_annotation meta plugin_platform_interface uuid]
- amplify_datastore_plugin_interface 0.6.2 [amplify_core collection flutter meta]
- amplify_flutter_android 0.6.2 [flutter]
- amplify_flutter_ios 0.6.2 [amplify_core flutter]
- analyzer 4.2.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- args 2.3.1
- async 2.8.2 [collection meta]
- aws_common 0.1.1 [async collection http meta stream_transform uuid]
- bloc 8.0.3 [meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- build 2.3.0 [analyzer async convert crypto glob logging meta path]
- build_config 1.0.0 [checked_yaml json_annotation path pubspec_parse yaml]
- built_collection 5.1.1
- built_value 8.3.3 [built_collection collection fixnum meta]
- characters 1.2.0
- charcode 1.3.1
- checked_yaml 2.0.1 [json_annotation source_span yaml]
- clock 1.1.0
- collection 1.16.0
- connectivity_plus_linux 1.3.1 [flutter connectivity_plus_platform_interface meta nm]
- connectivity_plus_macos 1.2.4 [connectivity_plus_platform_interface flutter]
- connectivity_plus_platform_interface 1.2.1 [flutter meta plugin_platform_interface]
- connectivity_plus_web 1.2.2 [connectivity_plus_platform_interface flutter_web_plugins flutter]
- connectivity_plus_windows 1.2.2 [connectivity_plus_platform_interface flutter]
- convert 3.0.2 [typed_data]
- crypto 3.0.2 [typed_data]
- dart_style 2.2.3 [analyzer args path pub_semver source_span]
- dbus 0.7.3 [args ffi meta xml]
- device_frame 1.1.0 [freezed_annotation flutter]
- device_info_plus 4.0.0 [flutter device_info_plus_platform_interface device_info_plus_macos device_info_plus_linux device_info_plus_web device_info_plus_windows]
- device_info_plus_linux 2.1.1 [device_info_plus_platform_interface file flutter meta]
- device_info_plus_macos 2.2.3 [device_info_plus_platform_interface flutter]
- device_info_plus_platform_interface 2.3.0+1 [flutter meta plugin_platform_interface]
- device_info_plus_web 2.1.0 [device_info_plus_platform_interface flutter_web_plugins flutter]
- device_info_plus_windows 2.1.1 [device_info_plus_platform_interface ffi flutter win32]
- fake_async 1.3.0 [clock collection]
- ffi 1.2.1
- file 6.1.2 [meta path]
- firebase_analytics_platform_interface 3.2.0 [firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.4.1 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- firebase_core_platform_interface 4.5.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 1.7.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging_platform_interface 4.0.0 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 3.0.0 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- firebase_remote_config_platform_interface 1.1.12 [firebase_core flutter meta plugin_platform_interface]
- firebase_remote_config_web 1.1.1 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js]
- fixnum 1.0.1
- flutter_local_notifications_linux 0.5.0+1 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories]
- flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- glob 2.1.0 [async collection file path string_scanner]
- hive 2.2.3 [meta crypto]
- http 0.13.4 [async http_parser meta path]
- http_parser 4.0.1 [collection source_span string_scanner typed_data]
- intl 0.17.0 [clock path]
- js 0.6.4
- json_annotation 4.5.0 [meta]
- logger 1.1.0
- logging 1.0.2
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.4
- meta 1.7.0
- nested 1.0.0 [flutter]
- network_info_plus 2.1.3 [flutter meta network_info_plus_platform_interface network_info_plus_linux network_info_plus_macos network_info_plus_windows network_info_plus_web]
- network_info_plus_linux 1.1.2 [collection flutter meta network_info_plus_platform_interface nm]
- network_info_plus_macos 1.3.0 [network_info_plus_platform_interface flutter]
- network_info_plus_platform_interface 1.1.2 [flutter meta plugin_platform_interface]
- network_info_plus_web 1.0.1 [flutter flutter_web_plugins network_info_plus_platform_interface]
- network_info_plus_windows 1.0.2 [flutter network_info_plus_platform_interface]
- nm 0.5.0 [dbus]
- package_config 2.1.0 [path]
- package_info_plus 1.4.2 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path]
- package_info_plus_macos 1.3.0 [flutter]
- package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
- package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
- package_info_plus_windows 1.0.5 [package_info_plus_platform_interface ffi flutter win32]
- path 1.8.1
- path_drawing 0.5.1+1 [vector_math meta path_parsing flutter]
- path_parsing 0.2.1 [vector_math meta]
- path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- path_provider_android 2.0.16 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.10 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.6 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.4 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.7 [ffi flutter path path_provider_platform_interface win32]
- petitparser 4.4.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- process 4.2.4 [file path platform]
- provider 6.0.3 [collection flutter nested]
- pub_semver 2.1.1 [collection meta]
- pubspec_parse 1.2.0 [checked_yaml collection json_annotation pub_semver yaml]
- shared_preferences_android 2.0.12 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- sky_engine 0.0.99
- source_gen 1.2.2 [analyzer async build dart_style glob meta path source_span yaml]
- source_span 1.8.2 [collection path term_glyph]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_transform 2.0.0
- string_scanner 1.1.0 [charcode source_span]
- term_glyph 1.2.0
- test_api 0.4.9 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timezone 0.8.0 [path]
- typed_data 1.3.1 [collection]
- universal_io 2.0.4 [collection crypto meta typed_data]
- uuid 3.0.6 [crypto]
- vector_math 2.1.2
- watcher 1.0.1 [async path]
- webview_flutter_android 2.9.2 [flutter webview_flutter_platform_interface]
- webview_flutter_platform_interface 1.9.1 [flutter meta plugin_platform_interface]
- webview_flutter_wkwebview 2.9.2 [flutter path webview_flutter_platform_interface]
- win32 2.6.1 [ffi]
- xdg_directories 0.2.0+1 [meta path process]
- xml 5.3.1 [collection meta petitparser]
- yaml 3.1.1 [collection source_span string_scanner]

Device

Iphone 13, Iphone 12, Different android devices and emulator too

OS

IOS 15.5, Android API (30,32,33)

Deployment Method

Amplify CLI

CLI Version

9.1.0

Additional Context

No response

Amplify Config

const amplifyconfig = ''' { "UserAgent": "aws-amplify-cli/2.0", "Version": "1.0", "auth": { "plugins": { "awsCognitoAuthPlugin": { "UserAgent": "aws-amplify-cli/0.1.0", "Version": "0.1.0", "IdentityManager": { "Default": {} }, "CredentialsProvider": { "CognitoIdentity": { "Default": { "PoolId": "eu-west-1:fa1b4221-13ce-4fe0-###########", "Region": "eu-west-1" } } }, "CognitoUserPool": { "Default": { "PoolId": "eu-west-###########", "AppClientId": "###########", "Region": "eu-west-1" } }, "Auth": { "Default": { "OAuth": { "WebDomain": "yabi870f2da3-870f2da3-dev.auth.eu-west-1.amazoncognito.com", "AppClientId": "771727dq55o7f37l1iad82ko01", "SignInRedirectURI": "myapp://", "SignOutRedirectURI": "myapp://", "Scopes": [ "phone", "email", "openid", "profile", "aws.cognito.signin.user.admin" ] }, "authenticationFlowType": "USER_SRP_AUTH", "socialProviders": [ "GOOGLE" ], "usernameAttributes": [ "EMAIL" ], "signupAttributes": [ "EMAIL" ], "passwordProtectionSettings": { "passwordPolicyMinLength": 8, "passwordPolicyCharacters": [] }, "mfaConfiguration": "OFF", "mfaTypes": [ "SMS" ], "verificationMechanisms": [ "EMAIL" ] } } } } } }''';

bibaswan-bhawal commented 2 years ago

Have you tried changing the language at bottom Google keeps cookies of your language selection from if you have used Google sign in in other places. Also have you tried running on a fresh emulator

mufayed commented 2 years ago

Have you tried changing the language at bottom Google keeps cookies of your language selection from if you have used Google sign in in other places. Also have you tried running on a fresh emulator

I've tried that, I also sent the apk to my friend who does not use Arabic and the google sign-in page was in Arabic too.

bibaswan-bhawal commented 2 years ago

Have you tried on an emulator, if you are testing on a physical device Google sign in will use you location to show you the page specific to you locale language

bibaswan-bhawal commented 2 years ago

Sorry it would do that on an emulator as well if you’re based in a country speaking arabic

fjnoyp commented 2 years ago

Hi @mufayed where is your device ip address? Even if you set the device settings to English, if your IP shows you are in a Arabic speaking region, Google switches to the local language. I've had the problem on my side before when traveling in Europe (switched automatically to Italian, French, etc).

Can you try using a VPN and changing your IP address to an english speaking country and trying again?

dnys1 commented 2 years ago

As noted here, the only workaround seems to be appending a query parameter to the Google login page. Unfortunately, Cognito does not allow passing query parameters to the redirected login page, which would be required. This is currently a known limitation of Cognito: https://github.com/aws-amplify/amplify-flutter/issues/1528#issuecomment-1205936858.

mufayed commented 2 years ago

Hi @mufayed where is your device ip address? Even if you set the device settings to English, if your IP shows you are in a Arabic speaking region, Google switches to the local language. I've had the problem on my side before when traveling in Europe (switched automatically to Italian, French, etc).

Can you try using a VPN and changing your IP address to an english speaking country and trying again?

UAE, After testing on VPN it's changed to English, but that is not a solution because the application will target non-Arabic speakers, Is there a way of passing a parameter or forcing the google login page to be in English?

dnys1 commented 2 years ago

Hi @mufayed, as mentioned there is no way to currently pass query parameters to Google which would allow overriding the default locale behavior. This is a limitation of Cognito, unfortunately. I will leave this ticket open until they have a fix in place.

mufayed commented 2 years ago

Hi @mufayed, as mentioned there is no way to currently pass query parameters to Google which would allow overriding the default locale behavior. This is a limitation of Cognito, unfortunately. I will leave this ticket open until they have a fix in place.

Thank you, I hope the team solves this very soon.