* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************/ //require the auth class require_once 'auth.php'; //initialize a new PayPal Access instance $ppaccess = new PayPalAccess(); //if the code parameter is available, the user has gone through the auth process if (isset($_GET['code'])) { //make request to exchange code for an access token $token = $ppaccess->get_access_token(); echo "<h1>Token</h1>"; print_r($token); //use access token to get user profile $profile = $ppaccess->get_profile(); echo "<h1>User Profile</h1>"; print_r($profile); //make request to refresh an expired access token $refreshed = $ppaccess->refresh_access_token(); echo "<h1>Refreshed Token</h1>"; print_r($refreshed); //validate the id token and provide back validation object $verify = $ppaccess->validate_token(); echo "<h1>Token Validation</h1>"; print_r($verify); //log the user out