getResourceOwner($token); // Use these details to create a new profile printf('Hello %s!
', $userDetails->getFirstname()); } catch (Exception $e) { // Failed to get user details exit('Something went wrong: ' . $e->getMessage()); } // Use this to interact with an API on the users behalf echo "Token is: ", $token->getToken(), "
"; // Use this to get a new access token if the old one expires echo "Refresh token is: ", $token->getRefreshToken(), "
"; // Number of seconds until the access token will expire, and need refreshing echo "Expires at ", date('r', $token->getExpires()), "
"; // Allow the user to logout echo 'Logout
';