Skip to content

Commit

Permalink
Fixed oauth example
Browse files Browse the repository at this point in the history
  • Loading branch information
lildude committed Nov 14, 2010
1 parent d72a512 commit 3804dc6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions examples/example-oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with phpSmug. If not, see <http://www.gnu.org/licenses/>.
*/
?>
if (session_id() == "") { @session_start(); }
?>
<html>
<head>
<title>phpSmug OAuth Login Example</title>
Expand Down Expand Up @@ -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 );
Expand All @@ -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.
Expand Down

0 comments on commit 3804dc6

Please sign in to comment.