We have covered almost all OAuth connects like Facebook, Linkedin, Twitter and Google now its time to connect with Microsoft using PHP. Microsoft has launched OAuth connect few months back, Now i am going to write this tutorial how to connect with Microsoft OAuth connect, using this you can get valid user detail from Hotmail and Outlook Database. I am sure this tutorial helps you in your registration systems.
Previous OAuth Tutorials
Google OAuth, Facebook OAuth, Twitter OAuth and
LikedIn OAuth System
The script contains two folders called oAuth and images with PHP files.
Step 1: Create Microsoft Application
Click here go to Microsoft live development area and click create application link.
Step 2: Add domain
You will get your Client ID and Client secret. Give a redirect callback URL.
Step 3: Application Information
Write Down your application Information.
login.php
You have to edit login.php file and add your client_id and client_secret values in this file.
$ct->redirect = 'http://'.$_SERVER['HTTP_HOST'].'/microsoft_login.php';
$ct->ID = 'Microsoft Client ID';
$ct->secret = 'Microsoft Client Secret';
index.php
Contains PHP code and Microsoft OAuth session details.
<?php
session_start();
if(!isset($_SESSION['userdata']))
{
$content = '<a href="login.php"><img src="./images/microsoft_login.png" alt="Login with Microsoft"/></a>';
}
else
{
$content = $_SESSION['userdata'];
}
$title = "Microsoft Live login OAuth PHP";
$heading = "Welcome to Microsoft Live login OAuth PHP example.";
include('html.inc');
?>