Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identity Toolkit API config returns "CONFIGURATION_NOT_FOUND"

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"
    }
}

I can't understand why the Identity Toolkit API cannot find the configuration and update it as specified.

Does anyone know how it can be solved?

Thank you

like image 522
F.SO7 Avatar asked Jan 30 '26 18:01

F.SO7


1 Answers

I spent days config Firebase Auth without using Web UI :). Even checking the GCP audit log to see what backend call enables Firebase Auth.

enter image description here

However, I could not find the CreateConfig method at https://cloud.google.com/identity-platform/docs/reference/rest.

I tried this method and things work. https://cloud.google.com/identity-platform/docs/reference/rest/v2/projects.identityPlatform/initializeAuth

curl --request POST \
  --url "https://identitytoolkit.googleapis.com/v2/projects/$ENV_GCP_PROJECT_ID/identityPlatform:initializeAuth" \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --header "X-Goog-User-Project: $ENV_GCP_PROJECT_ID"

But the result is the new Identity Platform will be used instead of the old Identity Toolkit.

Looking at pricing, it seems (a bit) more expensive https://firebase.google.com/pricing. I personally will use the new one (as Google is pushing it :). Hope this answer somehow helps (or anyone can find the REST call to enable auth for the old Identity Toolkit)

like image 120
Nguyễn Đình Cương Avatar answered Feb 01 '26 13:02

Nguyễn Đình Cương



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!