[API] >[Auth0 Management API]> [Machine to Machine Applications(マシンツーマシンアプリケーション)] タブの順に移動します。
アプリケーションを見つけて認可します。
矢印をクリックして列を拡張し、必要なスコープを選択します。
上記のいずれかの方法を認証し、そのトークンを使って操作を実行できるようになります。
// 👆 We're continuing from the "getting started" guide linked in "Prerequisites" above. Append this to the index.php file you created there.if (isset($env['AUTH0_MANAGEMENT_API_TOKEN'])) { $auth0->configuration()->setManagementToken($env['AUTH0_MANAGEMENT_API_TOKEN']);}// Create a configured instance of the `Auth0\SDK\API\Management` class, based on the configuration we setup the SDK ($auth0) using.// If no AUTH0_MANAGEMENT_API_TOKEN is configured, this will automatically perform a client credentials exchange to generate one for you, so long as a client secret is configured.$management = $auth0->management();
// 👆 We're continuing from the code above. Append this to your source code file.$response = $management->clients()->getAll(['q' => 'josh']);// Does the status code of the response indicate failure?if ($response->getStatusCode() !== 200) { die("API request failed.");}// Decode the JSON response into a PHP array:$response = json_decode(response->getBody()->__toString(), true, 512, JSON_THROW_ON_ERROR);if (! empty($response)) { echo '<h2>Get All Clients</h2>'; foreach ($response as $result) { printf( '<p><strong>%s</strong> - %s</p>', $result['name'], $result['client_id'] ); }}