foreveralone

foreveralone Git Source Tree


Root/web/system/vendor/phpoauthlib2/example.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
 
use \phpoauthlib2\providers\GoogleAuthProvider;
use \phpoauthlib2\OAuth;
 
require 'OAuth.php';
require 'providers/GoogleAuthProvider.php';
 
$authProvider = new GoogleAuthProvider($_GET, [
    "client_id" => "apps.googleusercontent.com",
    "client_secret" => "<KEY>",
]);
 
$oauth = new OAuth($authProvider, $_GET);
 
$check = $oauth->check();
 
if ($check === true) {
    echo "Hello - " . $authProvider->getFirstName();
    echo "<br>Your email is - " . $authProvider->getEmail();
} else {
    header("Location: " . $check);
}

Archive Download this file

Branches

Tags

Number of commits:
Page rendered in 0.09757s using 11 queries.