private function authorizeBrowserWithIntegrationByAppName(KernelBrowser
$browser, string
$appName): void
{ $app =
$this->
fetchApp($appName);
if (!
$app) { throw new \
RuntimeException('No app found with name: ' .
$appName);
} $accessKey = AccessKeyHelper::
generateAccessKey('integration'
);
$secret = AccessKeyHelper::
generateSecretAccessKey();
$this->
setAccessTokenForIntegration($app->
getIntegrationId(),
$accessKey,
$secret);
$authPayload =
[ 'grant_type' => 'client_credentials',
'client_id' =>
$accessKey,
'client_secret' =>
$secret,
];
$browser->
request('POST', '/api/oauth/token',
$authPayload);
static::
assertIsString($browser->
getResponse()->
getContent());
$data =
json_decode($browser->
getResponse()->
getContent(), true, 512, \JSON_THROW_ON_ERROR
);