#[Route('/store-api/app-system/{name}/generate-token', name: 'store-api.app-system.generate-token', methods: ['POST'])]
public function generate(string
$name, SalesChannelContext
$context): JsonResponse
{ if ($context->
getCustomer() === null
) { throw AppException::
jwtGenerationRequiresCustomerLoggedIn();
} ['app_secret' =>
$appSecret, 'privileges' =>
$privileges] =
$this->
fetchAppDetails($name);
$key = InMemory::
plainText($appSecret);
$configuration = Configuration::
forSymmetricSigner( new Sha256(),
$key );
$expiration =
new \
DateTimeImmutable('+10 minutes'
);
$shopId =
$this->shopIdProvider->
getShopId();
$builder =
$configuration ->
builder() ->
issuedBy($shopId)