GoogleCloudPlatform / gsutil

A command line tool for interacting with cloud storage services.
Apache License 2.0
881 stars 336 forks source link

GCP Identity Toolkit API config returns "CONFIGURATION_NOT_FOUND" #1575

Open Yahllil opened 2 years ago

Yahllil commented 2 years ago

I am trying to enable Firebase Authentication in my project, and to add Phone Auth to it, via API (without using the GUI console).

I am using the Service Usage API in order to enable Identity Toolkit, and then trying to use Identity Toolkit API in order to add the Phone Auth.

I am enabling Identity Toolkit via the Service Usage API like this (POST request):

URL:

https://serviceusage.googleapis.com/v1/projects/MY_GCP_PROJ/services:batchEnable

Body:

{
  "serviceIds": ["identitytoolkit"]
}

And indeed, after running this request I see in GCP console that Identity Toolkit has been enabled.

After that, I try to update the config using Identity Toolkit API, like this (PATCH request):

URL:

https://identitytoolkit.googleapis.com/v2/projects/MY_GCP_PROJ/config?updateMask=signIn

Body:

{
    "signIn": {
        "phoneNumber": {
            "enabled": true,
            "testPhoneNumbers": {
                "+11111111111": "123456",
            }
        },
    }
}

But for some reason, I receive an error saying:

{
    "error": {
        "code": 404,
        "message": "CONFIGURATION_NOT_FOUND",
        "status": "NOT_FOUND"
    }
}

After I manually enable Identity Platform using the GCP GUI console, this command starts working.

Note: I am using this command on a newly created GCP project I'm creating using firebase projects:create command, using an external service account that has permissions to create/update all GCP projects in my organization

cuong0993 commented 2 years ago

Hope that you can see it here or at https://stackoverflow.com/a/74338538/4108002