\nuserName: {$resource['user']['userName']}";
echo "
\nName: {$resource['user']['firstName']}";
echo "
\nLast name: {$resource['user']['lastName']}";
echo "
\nEmail: {$resource['user']['email']}";
echo "
\nEdition: {$resource['edition']['name']}";
echo "
\nOrganization: {$resource['organization']['name']}";
// we can now use the access_token as much as we want to access protected resources
function getResource($access_token)
{
$test_api_url = 'https://cloud.memsource.com/web/api2/v1/auth/whoAmI';
// $test_api_url = 'https://cloud.memsource.com/web/api2/v1/projects';
// $test_api_url = 'https://cloud.memsource.com/web/api2/v1/projects/zFbwYXoMLoa3cJ60Vvldo2?purge=true';
$header = ["Authorization: Bearer {$access_token}"];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $test_api_url,
CURLOPT_HTTPHEADER => $header,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_RETURNTRANSFER => true
// CURLOPT_CUSTOMREQUEST => 'DELETE' <-- This is how to send a DELETE request
]);
$response = curl_exec($curl);
curl_close($curl);
return json_decode($response, true);
}