Encoding the JWT
We can now encode our JWT. The Firebase JWT library makes this really simple:
$jwt = JWT::encode($payload, $key, 'HS256');
I'll also show you how you can create a 256 bit secret key using SSL, like so:
openssl rand -base64 32
(This will work on Mac and Linux out of the box...not tried it on Windows yet...sorry, someone let me know if it works!)
Branch: https://github.com/GaryClarke/pest-tdd/tree/81-firebase-jwt
0 comments