summaryrefslogtreecommitdiffstats
path: root/examples/consumer/finish_auth.php
blob: 83a2939bde68748ee5f177765f73f26b57a6ed4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

require_once "common.php";
session_start();

// Retrieve the token from the session so we can verify the server's
// response.
$token = $_SESSION['openid_token'];

// Complete the authentication process using the server's response.
list($status, $info) = $consumer->completeAuth($token, $_GET);

$openid = null;

// React to the server's response.  $info is the OpenID that was
// tried.
if ($status != Auth_OpenID_SUCCESS) {
    $msg = sprintf("Verification of %s failed.", $info);
} else {
    if ($info) {
        // This means the authentication succeeded.
        $openid = $info;
        $success = sprintf("You have successfully verified %s as your identity.",
                       $openid);
    } else {
        // This means the authentication was ancelled.
        $msg = 'Verification cancelled.';
    }
}

include 'index.php';

?>