Closed edamov closed 5 years ago
Hi @edamov, did you find a solution ? thanks.
@YaniceSC Yes, I did. I found another library Spomky-Labs/jose. Here you can find an example. Also I've started to develop the library for sending push notifications - edamov/pushok
Great! I will have look then. thanks.
You can create OpenSSL
key with any function (or manually by bash link how to do this), and then use next functions code:
$key = openssl_pkey_get_private(file_get_contents($this->client->getContainer()->getParameter('jwt_secret_private')));
$jws = new JWS(['alg' => 'RS256'], 'OpenSSL');
$payload = [
'roles' => $permissions,
'username' => 'Vasya',
'userId' => 8,
'email' => 'test1@test.com',
'exp' => time() + 3360,
'iat' => time(),
];
$jws->setPayload($payload);
$jws->sign($key);
var_dump($jws->getTokenString());
I want to use
jose
library for generating JWT for Apple Push Notification. But I don't know how to implement it with this library. There are some requirements for generating this token: 1) Headers should be:2) Payload data should be:
3) APNs supports only provider authentication tokens that are signed with the ES256 algorithm.
So could you please provide an example of generating JWT token for Apple Push Notifications with you library?