Expand my Community achievements bar.

roomURL & authToken passing to FLEX not working

Avatar

Former Community Member

Hi All,

I've created php authentication server and that outs right roomURL and authToken like this,

http://cadcam.yonsei.ac.kr/services/cdf_gc/authentication/flashservices/services/Main.html?roomURL-h...

For passing these two variables, I have changed index.template.html as follow.

<script type="text/javascript">

            // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.

            var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";

            // To use express install, set to playerProductInstall.swf, otherwise the empty string.

            var xiSwfUrlStr = "${expressInstallSwf}";

 

                              var varset = location.href.split('?');

                              var varset_splitted = urlvar[1].split('&');

                              var roominfo = varset_splitted[0];

                              var tokeninfo = varset_splitted[1];

                              var room_fi = roominfo.split('-');

                              var token_fi = tokeninfo.split('-');

 

                                var flashvars = {};

                              flashvars.roomURL = room_fi[1]; -> this var might be "https://collaboration.adobelivecycle.com/kbdlab/teamproject"

                              flashvars.authToken = token_fi[1]; -> and this var might be "exx=eDp0ZWxsbWU4Njo6a2JkbGFiOmtzbXM3Nzp0ZWFtcHJvamVjdDoxMDowMjAyZmIzYjMzNTI4NWZhYTg0NmFiMzE1ZjhmYmY0NDNhMDBmYjMw"

 

            var params = {};

            params.quality = "high";

            params.bgcolor = "${bgcolor}";

            params.allowscriptaccess = "sameDomain";

            params.allowfullscreen = "true";

            var attributes = {};

            attributes.id = "${application}";

            attributes.name = "${application}";

            attributes.align = "middle";

            swfobject.embedSWF(

                "${swf}.swf", "flashContent",

                "${width}", "${height}",

                swfVersionStr, xiSwfUrlStr,

                flashvars, params, attributes);

            // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.

            swfobject.createCSS("#flashContent", "display:block;text-align:left;");

        </script>

Added some codes to flex as well.



[Bindable]


private var roomURL:String = FlexGlobals.topLevelApplication.parameters["roomURL"];


//private var roomURL:String;


[Bindable]


private var authToken:String = FlexGlobals.topLevelApplication.parameters["authToken"];


//private var authToken:String;

protected function CreationCompleteHandler(event:FlexEvent):void

                              {

                                        //roomURL = FlexGlobals.topLevelApplication.parameters.roomURL;

                                        //roomURL = "https://collaboration.adobelivecycle.com/kbdlab/kbdlab";

                                        //authToken = FlexGlobals.topLevelApplication.parameters.authToken;

                                        //authToken = "exx=eDprc21zNzc6OmtiZGxhYjprc21zNzc6a2JkbGFiOjEwMDo4NzhhZDQ4MjdhNGFjODdhODk2NWNmOTcwY2Q5OGYyMDhlOTQyMjUx";

                                        cSession.login();

                              } -> I disabled this function because it does not executed when I added creationComplete = CreationCompleteHander(event);.  I didn't know why it was not working. So I just disabled.

My problem is nothing happened when I run this system after programming as described above.

Although having searched this Forum and Google, I only found tips for passing variables by using AC_OEtags.js.

Since my flex uses swfobject.js, I'd like to know why this is not working and how to passing two variables from php to flex.

Please anybody help me to find right way!

Thanks,

Sungmin

PS. Have posted part of my mxml codes

<?xml version="1.0" encoding="utf-8"?>

<mx:Application layout="absolute"

                                        xmlns:s="library://ns.adobe.com/flex/spark"

                                        xmlns:mx="http://www.adobe.com/2006/mxml"

                                        xmlns:rtc="http://ns.adobe.com/rtc"

                                        xmlns:coreUI="http://ns.adobe.com/coreUI"

                                        xmlns:components="components.*"

                                        applicationComplete="init(event)"

                                        >

 

          <mx:Script>

                    <![CDATA[

                              import com.adobe.coreUI.controls.CameraUserBar;

                              import com.adobe.rtc.authentication.AbstractAuthenticator;

                              import com.adobe.rtc.collaboration.FilePublisher;

                              import com.adobe.rtc.collaboration.FileSubscriber;

                              import com.adobe.rtc.collaboration.WebcamSubscriber;

                              import com.adobe.rtc.events.AddInLauncherEvent;

                              import com.adobe.rtc.events.AuthenticationEvent;

                              import com.adobe.rtc.events.ChatEvent;

                              import com.adobe.rtc.events.CollectionNodeEvent;

                              import com.adobe.rtc.events.ScreenShareEvent;

                              import com.adobe.rtc.events.SessionEvent;

                              import com.adobe.rtc.events.SharedPropertyEvent;

                              import com.adobe.rtc.events.StreamEvent;

                              import com.adobe.rtc.events.UserEvent;

                              import com.adobe.rtc.messaging.NodeConfiguration;

                              import com.adobe.rtc.messaging.UserRoles;

                              import com.adobe.rtc.sharedManagers.FileManager;

                              import com.adobe.rtc.sharedManagers.StreamManager;

                              import com.adobe.rtc.sharedManagers.UserManager;

                              import com.adobe.rtc.sharedManagers.descriptors.FileDescriptor;

                              import com.adobe.rtc.sharedManagers.descriptors.StreamDescriptor;

                              import com.adobe.rtc.sharedManagers.descriptors.UserDescriptor;

                              import com.adobe.rtc.sharedModel.CollectionNode;

                              import com.adobe.rtc.sharedModel.SharedProperty;

                              import com.adobe.rtc.sharedModel.SimpleChatModel;

                              import com.adobe.rtc.sharedModel.descriptors.ChatMessageDescriptor;

 

                              import flash.display.Sprite;

                              import flash.net.URLRequest;

 

                              import mx.collections.ArrayCollection;

                              import mx.controls.Alert;

                              import mx.core.FlexGlobals;

                              import mx.events.CollectionEvent;

                              import mx.events.FlexEvent;

                              import mx.events.ListEvent;

                              import mx.events.MenuEvent;

                              import mx.events.ScrollEvent;

                              import mx.events.ScrollEventDetail;

                              import mx.events.StateChangeEvent;

                              import mx.utils.ObjectUtil;

                              import mx.utils.UIDUtil;

 

                              import org.osmf.events.TimeEvent;

 

 

                    ////////////////////////////////////////////////////////

                    ///  web camera

                    ///////////////////////////////////////////////////////

                    protected var _camSubscribers:Object;

                    protected var _currentSubscriber:WebcamSubscriber ;

                    protected var _sharedProperty:SharedProperty ;

 

                    ////////////////////////////////////////////////////////

                    ///  login

                    ///////////////////////////////////////////////////////

                    [Bindable]

                    private var roomURL:String = FlexGlobals.topLevelApplication.parameters["roomURL"];

                    //private var roomURL:String;

                    [Bindable]

                    private var authToken:String = FlexGlobals.topLevelApplication.parameters["authToken"];

                    //private var authToken:String;

                    ///////////////////////////////////////////////////////

                    ///  External Authentication

                    ///////////////////////////////////////////////////////

 

                              protected function CreationCompleteHandler(event:FlexEvent):void

                              {

                                        //roomURL = FlexGlobals.topLevelApplication.parameters.roomURL;

                                        //roomURL = "https://collaboration.adobelivecycle.com/kbdlab/kbdlab";

                                        //authToken = FlexGlobals.topLevelApplication.parameters.authToken;

                                        //authToken = "exx=eDprc21zNzc6OmtiZGxhYjprc21zNzc6a2JkbGFiOjEwMDo4NzhhZDQ4MjdhNGFjODdhODk2NWNmOTcwY2Q5OGYyMDhlOTQyMjUx";

                                        cSession.login();

                              }

 

                              protected function auth_authenticationFailureHandler(event:AuthenticationEvent):void

                              {

                                        Alert.show("Connection Failed due to the Authentication Process : Please Log-In and Connect Again.");

                              }

 

                              protected function auth_authenticationSuccessHandler(event:AuthenticationEvent):void

                              {

                                        FlexGlobals.topLevelApplication.enabled = true;

                              }

 

                    ////////////////////////////////////////////////////////

                    ///  text chat

                    ///////////////////////////////////////////////////////

                    public var chatModel:SimpleChatModel;

...

...

...

...

          </mx:Script>

 

          <rtc:AdobeHSAuthenticator id="auth" authenticationKey="{authToken}"

                                                                        authenticationFailure="auth_authenticationFailureHandler(event)"

                                                                        authenticationSuccess="auth_authenticationSuccessHandler(event)"

                                                                        />

 

          <rtc:ConnectSessionContainer id="cSession" width="100%" height="100%"

                                                                                 authenticator="{auth}" roomURL="{roomURL}" autoLogin="true">

 

                    <mx:HBox width="100%" height="40" backgroundColor="gray" >

...

...

...

          </rtc:ConnectSessionContainer>

</mx:Application>

2 Replies

Avatar

Level 3

Hi,

You could run this in Flex Builder in debug mode and send us the console output.  That might help.

I think the auth token expires in 15 minutes.  You are sure that your server creates a new auth token and it is immediately used to authenticate?

-Jamie

Avatar

Employee

Actually external authentication tokens don't have a timeout, but they "expire" when the room ends. So you can't create a token, start and stop a room and then try to reuse that token to start the room again.

In any case, yes, it would be helpful if you can be more specific on what error are you getting (logs are always welcome). "Not working" or "nothing happening" doesn't tell us much.