13 Replies Latest reply on Mar 31, 2010 8:10 AM by kglad

    Remote Login AS2

    iowaGuy Level 1

      Hello All,

       

      I am trying to build a remote login in my Flash application that passes my username/password to another site and logs in without the user seeing the login page. I have seen this done, but havent ever done it myself. I am using AS2 - CS3. below is as far as I got with a tutorial.

       

      i had this on my submit button:

       

      on (release) {
          var sendVar:LoadVars = new LoadVars();
          sendVar.authenticity_token = "fka9c9VRpKaxlhS1cJ5P5Itu3b1L2tkdy8nfuk87FAs=";
          sendVar.username = username_txt.text;
          sendVar.password = password_txt.text;
          sendVar.send("https://launchpad.37signals.com/authenticate","submit");
      }

       

      any advice or other tutorials would be great!

       

      Thanks in advance!

        • 1. Re: Remote Login AS2
          kglad Adobe Community Professional & MVP

          you're probably encountering a security sandbox issue.  to check you should be using a debug version of the flash player so you can see error messages.

          • 2. Re: Remote Login AS2
            iowaGuy Level 1

            I am getting that error, how would i go around that? (sorry if that is a dumb question i havent had to do this before)

             

            thanks for your reply!

            • 3. Re: Remote Login AS2
              kglad Adobe Community Professional & MVP

              you need to use a cross-domain security file.  check the flash help files for usage and examples under the security class.

              • 4. Re: Remote Login AS2
                iowaGuy Level 1

                thanks, i will check it out!


                • 5. Re: Remote Login AS2
                  kglad Adobe Community Professional & MVP

                  you're welcome.

                  • 6. Re: Remote Login AS2
                    iowaGuy Level 1

                    Hey kglad,

                     

                    I got the remote login to work after reading the documentation you suggested, but i have another question. I need to have the page that i just logged into open the new browser in fullscreen without the toolbar/address bar.. so basically a popup. I usually use:

                     

                    var popupBrowser:String = "window.open('url','win','width=800,height=450,toolbar=no,scrollbars=no,fullscreen=yes'); ";

                     

                    my_btn.onRelease = function(){
                        getURL("javascript:" + jsSnowcommand + " void(0);");
                    }

                     

                    and i am wondering how i add that to this:

                     

                    on (release) {
                        var sendVar:LoadVars = new LoadVars();
                        sendVar.username = "username";
                        sendVar.password = "password";
                        sendVar.token = "YWRtaW46MVFBLm5ldA==";
                        sendVar.scheme = "cookie";
                        sendVar.send("http://url/login", "Login"); _blank
                    }

                     

                     

                    I have tried everything I can think of to merge the 2 of these, but have been unsuccessful. I have looked for tutorials but haven't found anything that has been useful. would you mind pointing me in the right direction or to a tutorial that would be helpful?

                     

                    thanks for your help today!

                    • 7. Re: Remote Login AS2
                      kglad Adobe Community Professional & MVP

                      it wouldn't be good coding but they should both work if that on(release) is attached to my_btn.  is it?

                       

                      p.s.  please mark this thread as answered, if you can.

                      • 8. Re: Remote Login AS2
                        iowaGuy Level 1

                        thanks again for responding!

                         

                        They are both seperate actions that i want to combine in the most proper way possible (first time doing something like this) and i should have posted it exactly how i am using both, which is like this:

                         

                        //OPENING POPUP

                         

                        var popupBrowser:String = "window.open('url','win','width=800,height=450,toolbar=no,scrollbars=no,fullscreen=yes'); ";

                         

                        my_btn.onRelease = function(){

                         

                            getURL("javascript:" + jsSnowcommand + " void(0);");

                         

                        }

                         

                         

                         

                        //REMOTE LOGIN

                         

                        my_btn.onRelease = function(){

                         

                            var sendVar:LoadVars = new LoadVars();

                         

                            sendVar.username = "username";

                         

                            sendVar.password = "password";

                         

                            sendVar.token = "YWRtaW46MVFBLm5ldA==";

                         

                            sendVar.scheme = "cookie";

                         

                            sendVar.send("http://url/login", "Login"); _blank

                         

                        }
                        • 9. Re: Remote Login AS2
                          kglad Adobe Community Professional & MVP

                          that won't work.  what you had before would have worked but is not good coding practice.

                           

                          here's how it should be done:

                           


                           

                          //OPENING POPUP

                           

                          var popupBrowser:String = "window.open('url','win','width=800,height=450,toolbar=no,scrollbars=no,fullscr een=yes');";

                           


                           

                           

                          //REMOTE LOGIN

                           

                          my_btn.onRelease = function(){

                           

                              var sendVar:LoadVars = new LoadVars();

                           

                              sendVar.username = "username";

                           

                              sendVar.password = "password";

                           

                              sendVar.token = "YWRtaW46MVFBLm5ldA==";

                           

                              sendVar.scheme = "cookie";

                           

                              sendVar.send("http://url/login", "Login");

                          getURL("javascript:" + jsSnowcommand + " void(0);");

                           

                          }
                          • 10. Re: Remote Login AS2
                            iowaGuy Level 1

                            Thanks for the code, when I test it it logins like it is supposed, but in a normal browser, then opens a fullscreen browser with the login page. So it is opening 2 pages instead of logging in while in fullscreen. here is the actual code with the urls in:

                             

                            //OPENING POPUP
                            var popupBrowser = "window.open('http://192.168.3.5/login','win','width=800,height=450,toolbar=no,scrollbars=no,fullscreen= yes');";

                             

                            //REMOTE LOGIN
                            my_btn.onRelease = function(){
                                var sendVar:LoadVars = new LoadVars();
                                sendVar.username = "username";
                                sendVar.password = "password";
                                sendVar.token = "YWRtaW46MVFBLm5ldA==";
                                sendVar.scheme = "cookie";
                                sendVar.send("http://192.168.3.5/login", "Login");
                                getURL("javascript:" + popupBrowser + " void(0);");
                            }

                             

                             

                            i need to figure out how to make "sendVar.send("http://192.168.3.5/login", "Login");" open and login in a fullscreen popup... any ideas?

                             

                            thanks again for all of your help!

                            • 11. Re: Remote Login AS2
                              kglad Adobe Community Professional & MVP

                              oh, i didn't realize that's what you wanted to do.

                               

                              that's a problem that i don't think you can solve.  you might be able to append the username and password variables to your getURL argument but that would NOT be a secure way to transmit data.

                              • 12. Re: Remote Login AS2
                                iowaGuy Level 1

                                Security isnt an issue, this is on a kiosk and that IP is only available on their network. It will run locally and never hit the web... does that help?

                                 

                                thanks!

                                • 13. Re: Remote Login AS2
                                  kglad Adobe Community Professional & MVP

                                  then append a query string to the url and use javascript to parse the query string.  location.href will return the url (including query string).  you can then use javascript methods to isolate the username and password and fillout your form.