Skip to content

Instantly share code, notes, and snippets.

@kingcoyote
Created December 1, 2011 17:17
Show Gist options
  • Save kingcoyote/1418311 to your computer and use it in GitHub Desktop.
Save kingcoyote/1418311 to your computer and use it in GitHub Desktop.
<?php
// this is right
if(isset($_SESSION['oauth_access_token'])) {
$client->setAccessToken($_SESSION['oauth_access_token']);
} else {
$token = $client->authenticate();
$_SESSION['oauth_access_token'] = $token;
}
// this is wrong
if(isset($_SESSION['oauth_access_token'])) {
$client->setAccessToken($_SESSION['oauth_access_token']);
} else {
$token = $client->authenticate();
// rather than set the token as $token, i call authenticate a second time, which makes it think i want to re-auth
$_SESSION['oauth_access_token'] = $client->authenticate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment