Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added facebook example (non-functional yet)
- Loading branch information
1 parent
8b7be4c
commit dd597a9
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ composer.lock | |
public/config.php | ||
public/google/config.php | ||
public/github/config.php | ||
public/facebook/config.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
return array( | ||
|
||
'client_info' => array( | ||
'client_id' => '<client ID>', | ||
'redirect_uri' => '<redirect URI>', | ||
|
||
'authorization_endpoint' => 'https://accounts.google.com/o/oauth2/auth', | ||
'token_endpoint' => 'https://accounts.google.com/o/oauth2/token', | ||
'user_info_endpoint' => 'https://www.googleapis.com/oauth2/v1/userinfo', | ||
|
||
'authentication_info' => array( | ||
'method' => 'client_secret_post', | ||
'params' => array( | ||
'client_secret' => '<client secret>' | ||
) | ||
) | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
use InoOicClient\Flow\Basic; | ||
|
||
require __DIR__ . '/../../init_autoload.php'; | ||
|
||
$config = require __DIR__ . '/config.php'; | ||
|
||
$flow = new Basic($config); | ||
|
||
if (! isset($_GET['redirect'])) { | ||
|
||
try { | ||
$uri = $flow->getAuthorizationRequestUri('openid email profile'); | ||
_dump($uri); | ||
printf("<pre>%s</pre><br>", $uri); | ||
printf("<a href=\"%s\">Login</a>", $uri); | ||
} catch (\Exception $e) { | ||
_dump("$e"); | ||
printf("Exception during authorization URI creation: [%s] %s", get_class($e), $e->getMessage()); | ||
} | ||
} else { | ||
|
||
try { | ||
$userInfo = $flow->process(); | ||
printf("<pre>%s</pre>", print_r($userInfo, true)); | ||
} catch (\Exception $e) { | ||
_dump("$e"); | ||
printf("Exception during user authentication: [%s] %s", get_class($e), $e->getMessage()); | ||
} | ||
} |