Expand my Community achievements bar.

Passing un + password Variables into LCCS in a URL for automated login

Avatar

Level 1

Hello,

Could anyone give me some pointers on how to have one of our apps "log" users into an LCCS room through a POST or something in a URL?

We are trying to have users be directed from one web page (where we would already establish their un and pw) and then dropped into a room without having to log in.

Iow, what I really want to know is how do I form the URL leading ino the Next.php file so the authentication can happen?

Thanks!

A

Presently we had a basic "Login.php" page that captured un + pw like his-

<html>

    <head>   

        <head>   

        <title>foo</title>

    </head>   

    <body>

   

    <style>

    body { background-color: #ffffff; }

    </style>

   

<table width="1680" border="0">

<tr>

<td colspan="2" style="background-color:#229ff2;">

<font size="3" face="arial" color="ffffff">

<h1>Welcome to foo</h1>

</td>

</tr>

<br />

<br />

<table width="1680" border="0">

<tr>

<font size="3" face="arial" color="333333">

<title>foon</title>

    </head>   

    <body>

   

    <style>

    body { background-color: #ffffff; }

    </style>

   

<h4 style="font-size:21px;"></h4>

<h4></h4>

<p style="font-size:22px;"> </p>

<h4> </h4>

<h4></h4>

<h4 style="font-size:21px;">Please login</h4>

        <form method="POST" action="Next.php">

            <b>Your Name</b>

            <input type="text" name="username">

            <b>Password</b>

            <input type="Your password" name="password">

            <input type="hidden" name="submitted" value="true" />

            <input type="submit" value="Enter Room"></td>

        </form>

<p </p>

<p style="font-size:16px;"><i>If you are having trouble logging in please foo</i></p>

</body>

</html>

________________________________________

The Next.php which managed the POST method and authenticated the user was the basic LCCS component which looked like this-

<?php

require_once("lccs.php");

   

$account = "foo-account";

$room    = "nov27";

$devUsername = "foo2@foo.com";

$devPassword = "oof";

$secret  = "234237491823741238947123947234233";

$accountURL = "https://connectnow.acrobat.com/{$account}";

$roomURL = "{$accountURL}/{$room}";

$message = "";

$username = "";

$displayName = "";

$role = 0;

session_start();

if( isset($_POST['submitted']))

{

    $username = $_POST['username'];

    $password = $_POST['password'];

   

    // Set our roles depending on the username/password

    // This is where you would place your own authentication logic

   

    if( ($password == "fdas") )

    {

        $displayName = $username;

        $role = 100;

    } else if ($password == "adsf")

    {

        $displayName = $username;

        $role = 50;

    } else if ($password == "werr")

    {

        $displayName = $username;

        $role = 10;

    }

   

    // set up the instance of the account using the AFCSAccount class

    $account = new RTCAccount($accountURL);

    // use the developer portal login to create the session

    $account->login($devUsername,$devPassword);

   

    // get room info

    $info = $account->getRoomInfo($room);

   

    $info = new SimpleXMLElement($info);

    $status = $info->status[0];

    if($status["code"] == "error" && $status["subcode"] == "bad-instance"){

        $account->createRoom($room, "FOOx");

    }

    // retrieve our session information

    $session = $account->getSession($room);

    // Use our user's credentials to get the token

    // The method takes the secret, the username, the display name, and the role

    $token = $session->getAuthenticationToken($secret, $displayName, $username, $role);

   

    //echo($token);

   

    if (isset($token) && $role > 0)

    {

        $message = "Successfully logged in";

        /*

        print(

        "win = window.open(".

        "'Foos.html?roomURL={$roomURL}&authToken={$token}',".

        "'_blank',".

        "'left=0,top=0,width=1280,height=720,toolbar=1,resizable=1');");

        */

        $accessAllowed = true;

    }

    else

    {

        $message = "The password you entered was incorrect.";

        $accessAllowed = false;

    }

   

}

?>

Any help is terrific!

1 Reply

Avatar

Former Community Member

Hi devx6,

You can find the PHP LCCS code in the "Server Intergration" section of the SDK. I think you need to generate and pass to your flash movie a external authenication token using your own server as this the offical documentated method for production apps. Check out the following URL's.

https://learn.adobe.com/wiki/display/lccs/6.4+Authentication+setup
http://flashrealtime.com/tuts/external-authentication-afcs.html
http://www.flashrealtime.com/external-authentication-afcs/
http://ria.dzone.com/articles/integrating-php-flash

http://yankovich.in/archives/tag/lccs

Hope this helps,

James