Auth0 Home Blog Docs

Cannot authenticate to Firebase using Auth0 token



I’m using the delegate endpoint (on Android) to get a token to Amazon (aws) and Firebase. The Amazon delegation is working fine, but when I try to login to Firebase using the Auth0 token I get an error saying:

The custom token format is incorrect. Please check the documentation.

The code I’m using is:

        JSONObject jsonObject = new JSONObject();
        jsonObject.put("client_id", clientId);
        jsonObject.put("grant_type", "urn:ietf:params:oauth:grant-type:jwt-bearer");
        jsonObject.put("id_token", idToken);
        jsonObject.put("scope", "openid profile email");
        jsonObject.put("api_type", "firebase");

        JsonObjectRequest objectRequest = new JsonObjectRequest(Request.Method.POST, AUTH0_DOMAIN_URL, jsonObject, responseListener, errorListener);

I got the response: {"token_type":"Bearer","expires_in":36000,"id_token":"eyJ0eXA[…]f0"}, and I use this id_token to authenticate to Firebase using signInWithCustomToken() method