PHP code example of unitedworldwrestling / oauth2-arena
1. Go to this page and download the library: Download unitedworldwrestling/oauth2-arena library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
unitedworldwrestling / oauth2-arena example snippets
$provider = new Unitedworldwrestling\OAuth2\Client\Provider\Arena([
'clientId' => '{arena-client-id}',
'clientSecret' => '{arena-client-secret}',
'redirectUri' => 'https://example.com/callback-url',
'host' => 'https://api.instagram.com' // Optional, defaults to https://api.instagram.com
]);
// Try to get an access token (using the https://arena.uww.io/grants/api_key grant)
$token = $provider->getAccessToken('https://arena.uww.io/grants/api_key');
// Optional: Now you have a token you can look up a users profile data
try {
// We got an access token, let's now get the user's details
$user = $provider->getResourceOwner($token);
// Use these details to create a new profile
printf('Hello %s!', $user->getName());
} catch (Exception $e) {
// Failed to get user details
exit('Oh dear...');
}
// Use this to interact with an API on the users behalf
echo $token->getToken();