Expand my Community achievements bar.

SOLVED

Using ConnectSession.authenticator.logout()

Avatar

Level 2

Hi there

I'm following the LCCS tutorials,and I'm on the second one where you create a login screen. I've added a password box so that I can log in as myself, the developer or as a "guest" (who is autopromoted to participant because of the room settings)

I've also added a "logout" button to the main application that does the following

protected function logout():void

{
                cSession.authenticator.userName="";
                cSession.authenticator.password="";
                cSession.logout();
                showLogin();
}

so that a person can log out then log back in as another user.

The problem is that it works fine when I log in the first time but when I logout then log in the second time, I get a "Invalud Username or Password" error.. is there something I'm forgetting to do ... or am doing wrong with the logout() ?

Would I possibly be better off creating the ConnectSessionAuthenticator in script rather than MXML and creating it explicitly each time?

Error: Invalid username or password:Login again
    at com.adobe.rtc.authentication::AbstractAuthenticator/onLoginFailure()[C:\work\main\connect\cocomo\src\com\adobe\rtc\authentication\AbstractAuthenticator.as:182]
    at com.adobe.rtc.authentication::AdobeHSAuthenticator/onComplete()[C:\work\main\connect\cocomo\src\com\adobe\rtc\authentication\AdobeHSAuthenticator.as:197]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

One line you should change in your LoginDialog is

if (password.length>0){

connectSession.authenticator.password=userPasswordField.text;

}else {

connectSession.authenticator.password = null ;

}

i.e. also the set the password to null in case you are getting in as guest(else it will be taken as "" ).

And then try with IE or some other browser clearing the cache. Then you can login as a different user the second time.

Thanks

Hironmay Basu

View solution in original post

9 Replies

Avatar

Level 2

maybe i can do something in my showLogin() function like..

                // Setting up Connect Session Conatainer in Script
                var theConnectSessionContainer:ConnectSessionContainer = new ConnectSessionContainer();
                theConnectSessionContainer.id="newSession";
                theConnectSessionContainer.roomURL="https://connectnow.acrobat.com/myUserName/mysecondroom";
                theConnectSessionContainer.autoLogin=false;
                theConnectSessionContainer.authenticator=new AdobeHSAuthenticator();

possibly?

Avatar

Former Community Member

Your stuff looks ok, can you send me a complete test code where this login fails so that I point out any mistakes or errors.

Thanks

Hironmay Basu

Avatar

Employee

hi,

When you log back in do you reset your cSession.authenticator.userName && cSession.authenticator.password. You seem to set it to null.

So this should work for you,

// Setting up Connect Session Conatainer in Script
                var theConnectSessionContainer:ConnectSessionContainer = new ConnectSessionContainer();
                theConnectSessionContainer.id="newSession";
                theConnectSessionContainer.roomURL="https://connectnow.acrobat.com/myUserName/mysecondroom";
                theConnectSessionContainer.autoLogin=false;
               // theConnectSessionContainer.authenticator=new AdobeHSAuthenticator();

               var authenticator:AdobeHSAuthenticator = new AdobeHSAuthenticator();

               authenticator:userName = "login Dialog.userNameField.text";

               authenitcator.password = "login Dialog.passwordField.text";

Thanks

Arun

Avatar

Level 2

I realized after I suggested this that I have no idea how to create the actual UI of the room if I create the connect session conatiner in script... specifically, the roster, webcam and the whiteboard...im guessing there's an example of that somewhere in the myriad of examples though...

<rtc:ConnectSessionContainer width="100%" height="90%" 
     autoLogin="false"
     id="cSession"
     roomURL="https://connectnow.acrobat.com/myAccountName/mysecondroom">
    
     <rtc:authenticator>
          <rtc:AdobeHSAuthenticator/>
     </rtc:authenticator>

     <mx:HBox width="100%" height="100%">
          <mx:VBox width="25%" height="100%">
               <rtc:Roster width="100%" height="50%"/>
               <rtc:WebCamera width="100%" height="50%"/>
          </mx:VBox>
          <rtc:SharedWhiteBoard id="whiteboard" width="75%" height="100%"/>
     </mx:HBox>
</rtc:ConnectSessionContainer>

Avatar

Level 2

I'll attach the two files here from my FlexBuilder 3 App.

LiveSupport.mxml and LoginDialog.mxml, both right in /src

Avatar

Former Community Member

You may not find examples specific to create all of whiteboard, webcam , roster in a script. But you can find codes for creating webcampublisher, subscriber , sharedproerty and so on using script in examples.

The process for creating pods in scripts is more or less same.

For e.g. for roster something like

if(!_roster) {

_roster = new Roster();

_roster.id = id;

addChild(_roster); // addchild subscribes the pod to the network

}

Similarly for other pods, its just you would create and add UIComponents in flex normally.

Hope this helps

Thanks

Hironmay Basu

Avatar

Former Community Member

Hi,

I ran your codes and it works perfectly fine for me.

I don't know if there is some caching issue ? Which browser you are using?

I logged in and out multiple times with ease. Try connecting to player 9 src and debug and see whats the username and password you are getting when you are hitting the error.

Otherwise,Your code looks and works fine to me.

Thanks

Hironmay Basu

Avatar

Correct answer by
Former Community Member

One line you should change in your LoginDialog is

if (password.length>0){

connectSession.authenticator.password=userPasswordField.text;

}else {

connectSession.authenticator.password = null ;

}

i.e. also the set the password to null in case you are getting in as guest(else it will be taken as "" ).

And then try with IE or some other browser clearing the cache. Then you can login as a different user the second time.

Thanks

Hironmay Basu

Avatar

Level 2

That was it! Firefox was caching the SWF, and I needd to null out that password. Works like a charm. Spike successful! Thanks for all your help

John

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----