From 3804dc6577f0815b1a0e1b96afd55cb8524c6b77 Mon Sep 17 00:00:00 2001 From: Colin Seymour Date: Sun, 14 Nov 2010 10:05:28 +0000 Subject: [PATCH] Fixed oauth example --- examples/example-oauth.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/example-oauth.php b/examples/example-oauth.php index 542fee4..be31aab 100644 --- a/examples/example-oauth.php +++ b/examples/example-oauth.php @@ -17,7 +17,8 @@ * You should have received a copy of the GNU General Public License * along with phpSmug. If not, see . */ - ?> +if (session_id() == "") { @session_start(); } +?> phpSmug OAuth Login Example @@ -57,10 +58,7 @@ // Perform the 3 step OAuth Authorisation process. // NOTE: This is a very simplified example that does NOT store the final token. // You will need to ensure your application does. - - if ( session_id() == "" ) { @session_start(); } - - if ( ! $_SESSION['SmugGalReqToken'] ) { + if ( ! isset( $_SESSION['SmugGalReqToken'] ) ) { // Step 1: Get a Request Token $d = $f->auth_getRequestToken(); $_SESSION['SmugGalReqToken'] = serialize( $d ); @@ -75,7 +73,7 @@ session_unregister( 'SmugGalReqToken' ); // Step 3: Use the Request token obtained in step 1 to get an access token - $f->setToken( "id={$reqToken['id']}", "Secret={$reqToken['Secret']}" ); + $f->setToken("id={$reqToken['Token']['id']}", "Secret={$reqToken['Token']['Secret']}"); $token = $f->auth_getAccessToken(); // The results of this call is what your application needs to store. // Set the Access token for use by phpSmug.