-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathauthentication.php
39 lines (31 loc) · 1.06 KB
/
authentication.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require dirname(__FILE__) . "/../vendor/autoload.php";
/**
* Read this before set your callback url while in Sandbox mode
* @see https://groups.google.com/forum/#!topic/feedly-cloud/vSo0DuShvDg/discussion
*/
$feedly = new feedly\Feedly(new feedly\Mode\SandBoxMode(), new feedly\AccessTokenStorage\AccessTokenSessionStorage());
$loginUrl = $feedly->getLoginUrl("sandbox", "http://localhost");
if (isset($_GET['code'])) {
/**
* Response will contain the Access Token and Refresh Token
*/
$tokens = $feedly->getTokens(
"sandbox",
"JSSBD6FZT72058P51XEG",
$_GET['code'],
"http://localhost/"
);
/**
* You must update Client's Secret(YDRYI5E8OP2JKXYSDW79 ) once in a while
* @see https://groups.google.com/forum/#!topic/feedly-cloud/a_cGSAzv8bY
*/
echo $tokens;
}
if (!isset($_SESSION['feedly_access_token'])) {
/**
* After redirection replace "localhost" with your domain
* keeping the Auth Code GET param
*/
echo "<a href=\"" . $loginUrl . "\">Authenticate using Feedly</a>";
}