Skip to content

Commit 3804dc6

Browse files
committed
Fixed oauth example
1 parent d72a512 commit 3804dc6

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

examples/example-oauth.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with phpSmug. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
?>
20+
if (session_id() == "") { @session_start(); }
21+
?>
2122
<html>
2223
<head>
2324
<title>phpSmug OAuth Login Example</title>
@@ -57,10 +58,7 @@
5758
// Perform the 3 step OAuth Authorisation process.
5859
// NOTE: This is a very simplified example that does NOT store the final token.
5960
// You will need to ensure your application does.
60-
61-
if ( session_id() == "" ) { @session_start(); }
62-
63-
if ( ! $_SESSION['SmugGalReqToken'] ) {
61+
if ( ! isset( $_SESSION['SmugGalReqToken'] ) ) {
6462
// Step 1: Get a Request Token
6563
$d = $f->auth_getRequestToken();
6664
$_SESSION['SmugGalReqToken'] = serialize( $d );
@@ -75,7 +73,7 @@
7573
session_unregister( 'SmugGalReqToken' );
7674

7775
// Step 3: Use the Request token obtained in step 1 to get an access token
78-
$f->setToken( "id={$reqToken['id']}", "Secret={$reqToken['Secret']}" );
76+
$f->setToken("id={$reqToken['Token']['id']}", "Secret={$reqToken['Token']['Secret']}");
7977
$token = $f->auth_getAccessToken(); // The results of this call is what your application needs to store.
8078

8179
// Set the Access token for use by phpSmug.

0 commit comments

Comments
 (0)