muxinc / mux-php

Official Mux API wrapper for PHP projects, supporting both Mux Data and Mux Video.
MIT License
40 stars 30 forks source link

Params not being passed with JWT #26

Closed mikemike closed 3 years ago

mikemike commented 3 years ago

I'm trying to pass some parameters via my JWT to the API. In this case I want to edit the start time on a gif, but there are other things I'm attempting too.

As per the docs I'm calling: JWT::encode($payload, base64_decode($keySecret), 'RS256')

In this instance below is my $payload (I've redacted the sub and kid):

array:5 [
  "sub" => "************"
  "aud" => "g"
  "exp" => 1613156632
  "kid" => "**********"
  "params" => array:1 [
    "start" => 30
  ]
]

This gives me a token, which is valid, and appending it to my animated.gif URL does give me a gif, however the start param is totally ignored. I've tried various values here including fps and end, as well as width and height when generating thumbnails. However, nothing I do affects the output, it's always a 15fps gif starting from 0s.

What am I missing?

dylanjha commented 3 years ago

@mikemike can you try this for the $payload?

array:5 [
  "sub" => "************"
  "aud" => "g"
  "exp" => 1613156632
  "kid" => "**********"
   "start" => 30
]
mikemike commented 3 years ago

Perfect, that works. Thanks.

Might be worth updating the docs to include this. It's slightly different under the node JWT implementation - understandably as it uses a different library.

Cheers