Search code examples
flutterflutter-web

idpiframe_initialization_failed, Not a valid origin for the client flutter web


I try to make user can use login by google in flutter web. Every thing worked if I use this comment:

flutter run -d chrome --web-hostname localhost --web-port 5000

But if I work it by button run in android studio I get this error:

PlatformException(idpiframe_initialization_failed, Not a valid origin for the client: http://localhost:64263 has not been registered for client ID ********. Please go to https://console.developers.google.com/ and register this origin for your project's client ID., https://developers.google.com/identity/sign-in/web/reference#error_codes, null)

I add google-signin-client_id in index page.

I want know how I can solve this problem and after I publish my web how this will work because I can't then use comment -web-port 5000?


Solution

  • well you need to add your url to the Authorized JavaScript origins at https://console.cloud.google.com/apis/credentials to your Web Client

    credentials