Did you try using URLLoader to get the response codes and respond as needed? 
(I’m not that familiar with StageWebView, but I imagine there’s a way to 
intercept the request.)

I’ve needed to respond to specific response codes and I use this pattern:
                        if(loader == null){
                                loader = new URLLoader();
                                configureListeners(loader);
                        }


                private function 
configureListeners(dispatcher:IEventDispatcher):void {
                        dispatcher.addEventListener(Event.COMPLETE, 
completeHandler);
                        dispatcher.addEventListener(Event.OPEN, openHandler);
                        
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, 
securityErrorHandler);
                        
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
//                      
dispatcher.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS,httpResponseStatusHandler);//
 AIR ONLY
                        dispatcher.addEventListener(IOErrorEvent.IO_ERROR, 
ioErrorHandler);
                }
                private function httpStatusHandler(ev:HTTPStatusEvent):void{
                        //trace (ev);
                        status  = String(ev.status);
                }

                private function completeHandler(ev:Event):void{
                        var eventType:String;
                        bytes = loader.data as ByteArray;
                        var responseData:XML;
                        switch(status){
                                case  "200":
                                        // do something

                                        break;
                                case  "202":
                                        // do something else
                                        break;
                        }
                }

Harbs

On Sep 11, 2015, at 1:52 PM, Christofer Dutz <[email protected]> wrote:

> Hi Maxim, 
> 
> the problem is not authenticating against G+ from mobile, but authenticating 
> against G+ using Keycloak. It's sort of a OAuth proxy you can use. It seems 
> that this returns Http 307 responses for redirecting to the individual login 
> pages. 
> 
> Chris
> 
> ________________________________________
> Von: Maxim Solodovnik <[email protected]>
> Gesendet: Freitag, 11. September 2015 11:24
> An: [email protected]
> Betreff: Re: StageWebView not able to understand Http 307 Responses?
> 
> Hello Chris,
> 
> I was able to auth against G+ using this code:
> http://stackoverflow.com/questions/10717919/how-to-integrate-google-in-a-flex-mobile-application
> (slightly modified)
> 
> On Fri, Sep 11, 2015 at 3:10 PM, Christofer Dutz <[email protected]>
> wrote:
> 
>> Hi,
>> 
>> 
>> First of all ... this is probably more an AIR question as it is a Flex
>> question, but I am thinking that here eventually someone knows the answer
>> to this question.
>> 
>> 
>> I'm struggling to make my Flex-based mobile application use Keycloak as
>> OAuth2 server. So far I got most of it working.
>> 
>> 
>> For anyone not familiar with Keycloak. It allows me to: Create a login on
>> Keycloak itself or use an OAuth service such as Github, Google+, Twitter,
>> ...
>> 
>> Whenever a user wants to login, keycloak shows a login screen (HTML Page)
>> with username+password fields as well as buttons for each of the services
>> that are configured. When clicking on "Github" for example, I am redirected
>> to a Github page asking me if I want to grant access to that application.
>> As soon ay I confirm this, I can simply login by clicking on the "Github"
>> button.
>> 
>> 
>> I am using a StageWebView for displaying the login screen and am using the
>> Adobe OAuth2 lib described here:
>> http://blogs.adobe.com/charles/2012/05/oauth-2-0-library-for-actionscript.html
>> 
>> OAuth 2.0 Library for ActionScript
>> Tweet
>> Weitere Informationen...<
>> http://blogs.adobe.com/charles/2012/05/oauth-2-0-library-for-actionscript.html
>>> 
>> 
>> 
>> 
>> Logging in with username+password works. Klicking on "github" however
>> doesn't. Investigating the communication with Wireshark now revealed that
>> when logging in with username+password a "http 302" response is returned
>> and that works fine. However if clicking on "github" keacloak returns a
>> "http 307" which should be handled slightly different. Unfortunately the
>> StageWebView doesn't react at all on this response.
>> 
>> 
>> Is this eventually not implemented? If yes ... is there a workaround or an
>> alternative to the StageWebView?
>> 
>> 
>> Chris
>> 
> 
> 
> 
> --
> WBR
> Maxim aka solomax

Reply via email to