PHP code example of hamidatyabi / auth2
1. Go to this page and download the library: Download hamidatyabi/auth2 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/ */
hamidatyabi / auth2 example snippets
$config = array(
"oauth2_host" => "localhost",
"oauth2_port" => "port",
"oauth2_client_id" => "client_id",
"oauth2_client_secret" => "client_secret"
);
$client = new \HamidAtyabi\OAuth2Client\AccessToken\AccessToken($config);
$result = $client->get("username", "password");
$config = array(
"oauth2_host" => "localhost",
"oauth2_port" => "port",
"oauth2_client_id" => "client_id",
"oauth2_client_secret" => "client_secret"
);
$client = new \HamidAtyabi\OAuth2Client\AccessToken\AccessToken($config);
$result = $client->validity("access_token");
$config = array(
"oauth2_host" => "localhost",
"oauth2_port" => "port",
"oauth2_client_id" => "client_id",
"oauth2_client_secret" => "client_secret"
);
$client = new \HamidAtyabi\OAuth2Client\RefreshToken\RefreshToken($config);
$result = $client->refresh("refresh_token");
$config = array(
"oauth2_host" => "localhost",
"oauth2_port" => "port",
"oauth2_client_id" => "client_id",
"oauth2_client_secret" => "client_secret"
);
$client = new \HamidAtyabi\OAuth2Client\User\User($config);
$result = $client->get("access_token");