I try to create jwt token using jwt_encode($algorithm, $payload, $key, $header_fields) (from https://docs.rightscale.com/ss/reference/rcl/v2/ss_RCL_functions.html#miscellaneous-jwt_encode)
But when I upload CAT file to Designer I got - Unknown function 'jwt_encode' at line 16, column 16 Use valid Cloud Application Template syntax
My code is similar to:
$payload = {"target_audience": $some_endpoint, "iss": "email", "sub": "email", "aud": "url", "exp": 1644320037, "iat": 1644320037}
$key = "key"
$header = {"alg": "RS256", "typ": "JWT"}
$jwt = jwt_encode("RS256", $payload, $key, $header)
COULD YOU HELP ME WITH THAT?
Thank you, Vasyl Stavinskyi
‎Feb 08, 2022 06:05 AM
I'd have to see more of the file, but I suspect the problem may be that your code is outside of an RCL definition and therefore cannot be parsed as RCL code. An RCL definition looks like:
define do_something($some_endpoint)
$payload = {"target_audience": $some_endpoint, "iss": "email", "sub": "email", "aud": "url", "exp": 1644320037, "iat": 1644320037}
$key = "key"
$header = {"alg": "RS256", "typ": "JWT"}
$jwt = jwt_encode("RS256", $payload, $key, $header)
...
end
‎Feb 16, 2022 01:43 PM
Actually I have the same separated method in my CAT file
‎Feb 16, 2022 01:50 PM
Hello,
First of all check your function availability, Syntax Or Context Error. Check the RightScale Documentation, Validate Your CAT code.
‎Jun 13, 2023 05:21 AM