<?php session_start(); $trello = new tschwemley\trello\Trello(array('clientKey' => $_SESSION['oauth_token'], 'clientSecret' => $_SESSION['oauth_token_secret'])); // Get the oauthVerifier that was sent back from Trello after access was granted. $oauthVerifier = $_GET['oauth_verifier']; // Pass OAuth Verifier and get access token $token = $trello->getAccessToken($oauthVerifier); // Set the session for the new access tokens, to replace the request tokens. $_SESSION['oauth_token'] = $token['oauth_token']; $_SESSION['oauth_token_secret'] = $token['oauth_token_secret']; // Create a new instance of the Trello Object with the new request Tokens $trello = new tschwemley\trello\Trello(array('clientKey' => $_SESSION['oauth_token'], 'clientSecret' => $_SESSION['oauth_token_secret'])); // Make an api call (using Trello API dev board as example) $cards = $trello->apiCall(array('boards', '4d5ea62fd76aa1136000000c'));
<?php session_start(); // Create a new instance of the Trello class $trello = new tschwemley\trello\Trello(array('clientKey' => null, 'clientSecret' => null)); // Get the request tokens based on consumer and secret keys. Store them in token array. $token = $trello->getRequestToken('http://dotaresource.com/trelloAPI/tests/callback.php'); // Store the tokens into a session so we can use them during callback $_SESSION['oauth_token'] = $token['oauth_token']; $_SESSION['oauth_token_secret'] = $token['oauth_token_secret']; // Get the authorize URL $data = $trello->getAuthorizeUrl($token['oauth_token'], array('name' => 'medhub', 'expiration' => 'never', 'scope' => 'read,write')); // Direct user to Trello 'Allow Access' screen header("Location: {$data}");