jeudi 15 décembre 2016

Why am I suddenly unable to refresh idToken with Firebase REST API in an AS3 AIR Android Project.?

I had integrated FIREBASE Authentication and Storage using this guide and it was working just fine. Yesterday suddenly, I am unable to get to refresh the token. Every time I call the refreshToken(idToken) method, I get a 400:Invalid Id Token error.

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 wasnt working. I have no idea what to do. Any help is greatly appreciated.

Here is the code I am using to refresh the token:

    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("http://ift.tt/2egrqjc"+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);   
    }

Aucun commentaire:

Enregistrer un commentaire