Open ptmkenny opened 4 weeks ago
I had the same issue today, the only way to make it work is to serialize it and send as JSON string:
This is the example in the docs:
use Symfony\Component\Serializer\Encoder\JsonEncode;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
// The serializer is the same as the one created in the previous pages
$jsonObject = $serializer->serialize(
$publicKeyCredentialCreationOptions,
'json',
[ // Optional
AbstractObjectNormalizer::SKIP_NULL_VALUES => true,
JsonEncode::OPTIONS => JSON_THROW_ON_ERROR,
]
);
After upgrading to 5.0, this fails because the value of json_encode() is false.
Indeed, json_encode
should not be used as in 5.0.+ the objects do not implement the JsonSerializable
interface.
Please use the Serializer instead.
Thank you for the updates. Also, Webauthn\PublicKeyCredentialSource::jsonSerialize()
was removed, but this isn't listed in the migration docs.
Version(s) affected
5.0
Description
Works in 4.9 but not 5.0:
json_encode(\Webauthn\PublicKeyCredentialRequestOptions::create(random_bytes(32), allowCredentials: []))
I need to json_encode() it to submit the request to my site via a JSON-RPC endpoint.
The docs still say:
How to reproduce
With 4.9, I was using this code:
After upgrading to 5.0, this fails because the value of json_encode() is false.
Possible Solution
No response
Additional Context
No response