Skip to content

Commit 21defa7

Browse files
committed
Merge pull request facebookarchive#94 from oyvindkinsey/master
Make getLoginStatusUrl use /dialog/oauth
2 parents 64fca94 + 88ffc93 commit 21defa7

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

examples/example.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
if ($user) {
4747
$logoutUrl = $facebook->getLogoutUrl();
4848
} else {
49+
$statusUrl = $facebook->getLoginStatusUrl();
4950
$loginUrl = $facebook->getLoginUrl();
5051
}
5152

@@ -76,6 +77,10 @@
7677
<?php if ($user): ?>
7778
<a href="<?php echo $logoutUrl; ?>">Logout</a>
7879
<?php else: ?>
80+
<div>
81+
Check the login status using OAuth 2.0 handled by the PHP SDK:
82+
<a href="<?php echo $statusUrl; ?>">Check the login status</a>
83+
</div>
7984
<div>
8085
Login using OAuth 2.0 handled by the PHP SDK:
8186
<a href="<?php echo $loginUrl; ?>">Login with Facebook</a>

src/base_facebook.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,15 @@ public function getLoginUrl($params=array()) {
588588
return $this->getUrl(
589589
'www',
590590
'dialog/oauth',
591-
array_merge(array(
592-
'client_id' => $this->getAppId(),
593-
'redirect_uri' => $currentUrl, // possibly overwritten
594-
'state' => $this->state),
595-
$params));
591+
array_merge(
592+
array(
593+
'client_id' => $this->getAppId(),
594+
'redirect_uri' => $currentUrl, // possibly overwritten
595+
'state' => $this->state,
596+
'sdk' => 'php-sdk-'.self::VERSION
597+
),
598+
$params
599+
));
596600
}
597601

598602
/**
@@ -618,24 +622,14 @@ public function getLogoutUrl($params=array()) {
618622
/**
619623
* Get a login status URL to fetch the status from Facebook.
620624
*
621-
* The parameters:
622-
* - ok_session: the URL to go to if a session is found
623-
* - no_session: the URL to go to if the user is not connected
624-
* - no_user: the URL to go to if the user is not signed into facebook
625-
*
626625
* @param array $params Provide custom parameters
627626
* @return string The URL for the logout flow
628627
*/
629628
public function getLoginStatusUrl($params=array()) {
630-
return $this->getUrl(
631-
'www',
632-
'extern/login_status.php',
629+
return $this->getLoginUrl(
633630
array_merge(array(
634-
'api_key' => $this->getAppId(),
635-
'no_session' => $this->getCurrentUrl(),
636-
'no_user' => $this->getCurrentUrl(),
637-
'ok_session' => $this->getCurrentUrl(),
638-
'session_version' => 3,
631+
'response_type' => 'code',
632+
'display' => 'none',
639633
), $params)
640634
);
641635
}

0 commit comments

Comments
 (0)