Creating a JWT on make (Json Web Token)

Hi,

I’m trying to create a JWT on the make.com functions by using these docs;

https://www.make.com/en/help/tools/http#how-to-generate-json-web-tokens--jwt-

Looks like this algorithm cannot create a correct JWT like I did with a github repo.

image

And jwt() function doesn’t work on the functions of make.com

I also used this library to create the JWT:

Tutorial for JWT generation · kjur/jsrsasign Wiki · GitHub

and it actually works with this repo with the same inputs.

What do I do wrong here?

Thank you

Hey,

I also treid to define iml.jwt() but it cannot find iml now

image
image
image

Hey,

I also tried with built-in functions but it doesn’t work;

https://www.make.com/en/help/tools/http#generating-a-jwt-via-built-in-functions

any answers from the community?

The documentation you linked describes the example done directly in the connection itself, and not in your own custom IML function.

Could you try reproducing the example in your app using a Basic Connection?

3 Likes

Thank you @samliew ! ,

I hope you are doing good,

You are right about this one, this should only go for connections and I was wrong about this way: JWT - Make Apps

How about these ways below? I already tried the suggested javascript to sign JWT with these ways and they didn’t work. Have you tried these before?

https://www.make.com/en/help/tools/http#how-to-generate-json-web-tokens--jwt-

https://www.make.com/en/help/tools/http#generating-a-jwt-via-built-in-functions

Those two you linked are custom functions, and are not available to use in your custom apps, because they are for Enterprise users only.

1 Like

Thank you @samliew ,

I’m an enterprise user and can use custom functions. The pointed algorithms in these links doesn’t work and cannot sign a JWT. Because I try the same inputs for JWT signing in another github algorithm and it works. But these doesn’t work:

https://www.make.com/en/help/tools/http#how-to-generate-json-web-tokens--jwt-

https://www.make.com/en/help/tools/http#generating-a-jwt-via-built-in-functions

Have you guys experienced something like this?

1 Like

Hi @onurbolaca hope you’re doing well!!

Based on your ticket with us, you are using RS256 algorithm in the header, but this function will only work for HS256 or HS512. I think the header values in the scenario are the only issue, given that according to the GitHub link you shared, simple HS256 encoding seems to be possible.

image

Regarding the ‘iml’ error, at the moment it’s not possible to test custom functions that use iml functions in the editor. The iml object is created at scenario runtime, so while the function will not work when testing in the editor, it should run correctly within the scenario. You can test it with a Set Variable module

I can assure you the code is correct. I helped with the update for this page just days ago and I compared the output to jwt.io :slight_smile:

Please reply to the ticket you have created if changing the header ALG to HS256 isn’t enough to solve it and I’ll gladly assist you further.

3 Likes