Using ColdFusion to generate JWT token

I am wondering if anyone has experience using ColdFusion to generate JWT tokens? I found a CF library in JWT.io but frankly I am not familiar with github and am having trouble with the documentation.
The documentation mentions installing the library using CommandBox or “Alternatively the git repository can be cloned into the desired directory.” Does this mean I can simply download the zip file and extract it to a directory of my choice? I’d like to think it’s that simple but the documentation doesn’t read that way. Then the documentation says, “Once the library has been installed, the core jwt component can be instantiated directly: jwt = new path.to.jwtcfml.models.jwt();”. Is this done at the command line in Windows? Is this a one time command? It’s just not very clear what needs to be done to “install” this library. If anyone can assist or is using some other ColdFusion solution I would very much appreciate some guidance.

Thanks.

Hey @cphawander,

I’ll leave your post here in case our community has any suggestions. In the meantime, you might also consider checking out StackOverflow and some other similar resources for ColdFusion specific guidance, too.

Best,
Will

Thanks Will. Just an update on this. I have been able to generate base64urlencoded values for the header and payload in ColdFusion, creating a “header.payload” string. I have verified the result on the JWT.io decoder; it returns my header and payload information accurately. The next step is hashing the value using HMACSHA256 algorithm, but ColdFusion’s hmac function - hmac(data, secret, “HMACSHA256”) - does not give me the result I want. Any guidance or assistance would be appreciated. Thanks.

Hey @cphawander,

Glad to hear you were able to generate those values. In regards to the SHA256 algorithm in ColdFusion, I’d recommend checking out StackOverflow for ColdFusion specific guidance.

Thanks,
Will

Will, I resolved my problem. Got everything to work. Thanks.

I’m happy to hear it, @cphawander! :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.