Why am I suddenly unable to refresh idToken with Firebase REST API in an AS3 AIR Android Project.?
<p>I have integrated Firebase Authentication and Storage using <a href="https://github.com/PhantomAppDevelopment/firebase-as3" rel="nofollow noreferrer">this</a> guide and it was working just fine. Yesterday suddenly, I am unable to get to refresh the token. Every time I call the <code>refreshToken(idToken)</code> method, I get a <code>400:Invalid Id Token</code> error. </p>

<p>I didn't change the code. I was testing the app one day and it was working fine, I checked that same app the next day and it wasn't working. I have no idea what to do. Any help is greatly appreciated.</p>

<p>Here is the code I am using to refresh the token:</p>

<pre><code>    private function refreshToken(idToken:String):void
    {
        trace("refreshing id token");
        var header:URLRequestHeader = new URLRequestHeader("Content-Type", "application/json");

        var myObject:Object = new Object();
        myObject.grant_type = "authorization_code";
        myObject.code = idToken;

        var request:URLRequest = new URLRequest("https://securetoken.googleapis.com/v1/token?key="+FIREBASE_API_KEY);
        request.method = URLRequestMethod.POST;
        request.data = JSON.stringify(myObject);
        request.requestHeaders.push(header);

        var loader:URLLoader = new URLLoader();
        loader.addEventListener(flash.events.Event.COMPLETE, refreshTokenLoaded);
        loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
        loader.load(request);   
    }
</code></pre>