Export (0) Print
Expand All

Running the PHP QuickStart Sample

Bb676632.note(en-us,MSDN.10).gifNote:
This topic describes functionality that will be obsolete. This functionality is provided only to support legacy applications. Live Connect incorporates features that provide equivalent functionality.

This topic explains how to install, run, and extend the QuickStart sample as provided in the PHP programming language.

Bb676632.note(en-us,MSDN.10).gifImportant:
The PHP QuickStart sample is preconfigured to use default values for the client ID, secret key, and return URL parameters. The return URL is preconfigured to point to http://localhost/webauth/sample/webauth-handler.php. For more information about how to customize these parameters, see Getting Your Client ID for Web Authentication.

When you install the sample, you put its files in the correct locations on your Web server. In this discussion, we assume that you have direct access to your Web server and that you develop and browse your site from the server.

Bb676632.note(en-us,MSDN.10).gifImportant:
To run these samples, you must install PHP version 5.2 or later.

To install the sample

  1. On an openSUSE 10.3 Linux platform, ensure that the apache2, apache2-mod_PHP5, php5-mhash, php5-mcrypt, php5-openssl, php5-dba, php5-hash, and php5-dom packages are installed by means of the YaST tool. You may need to obtain some of these packages from the Novell updates page (http://www.novell.com/linux/download/updates/102_i386.html).
  2. Sign in as the superuser by issuing the su command.
  3. Go to the /etc/apache2/ directory and use a text editor to open the default-server.conf file.
  4. Locate the <Directory "/srv/www/htdocs"> section (where "/srv/www/htdocs" is the document root for http://localhost/) and change the AllowOverride None line to AllowOverride All. This modification permits the .htaccess file that is included in the Web Authentication PHP package to take effect. You can inspect this file and make changes directly in the Apache configuration if you do not want to enable .htaccess overrides on the localhost.
  5. Save the default-server.conf file and restart Apache by issuing the following command: /etc/init.d/apache2 restart
  6. Go to the /srv/www/htdocs directory and uncompress the PHP package by issuing the following command: tar -zxvf <path>/webauth-php-1.2.tar.gz where <path> is the path to the webauth-php-1.2.tar.gz file that you downloaded.
  7. Rename the webauth-php-1.2 directory to "webauth" so that http://localhost/webauth/sample/ is the URL entry point for the QuickStart sample.

The PHP QuickStart sample is installed.

Bb676632.note(en-us,MSDN.10).gifImportant:
Included in the QuickStart sample is a file named Application-Key.xml. Make sure that the folder that contains this file cannot be accessed from the Internet, because the file contains important confidential information.

After you install the sample, you can run it to see a demonstration of how Windows Live ID works.

To run the sample

  1. Go to http://localhost/webauth/sample/.
  2. Click Sign in. You are directed to the Windows Live ID sign-in page.
  3. Type your valid Windows Live ID and password to sign in. You are redirected to the sample application. The Sign-in has now changed to Sign out.
  4. In the Name text box, type your name and then click Submit. Your name is stored and associated with your user ID for use when you sign in from now on.
  5. Click Sign out. You are signed out.

Before you can extend the sample, you must first register your application as described in Getting Your Client ID for Web Authentication. After you register your application, substitute your own client ID and secret key for the default values specified in the Application-Key.xml configuration file in the sample application.

Now you're ready to explore ways to develop the sample code further to meet your site's needs. Look through the PHP library in the file named WindowsLiveLogin.php to see what additional functionality is available to you. You can also read the topics in the Web Authentication Reference section for even more information about how Web Authentication works.

You can also customize the sign-in and registration pages that your users experience. For more information, see Customizing Sign-in and Registration.

Finally, you can share your discoveries and learn from others by participating in the Windows Live ID Development Forum. See you there!

Other Resources

Live Connect

Show:
© 2014 Microsoft