Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Error generating JWT token with python tool - NotImplementedError: Algorithm 'RS256

bomeers
5 - Atom

I am having issues creating a workflow that encodes a JWT token with the RS256 algorithm in the python tool.

 

Here is my code:

 

 

 

 

#################################
from ayx import Alteryx
from ayx import Package
import pandas
##Package.installPackages(package="cryptography",install_type="install --proxy proxy.server:port")  
##Package.installPackages(package="pyjwt[crypto]",install_type="install --proxy proxy.server:port")
import jwt
from io import StringIO


#################################
table = Alteryx.read("#1")


#################################
print(table)


#################################
id = table.at[0, 'id']


#################################
url = table.at[0, 'url']


#################################
key = table.at[0, 'key']


#################################
exp = table.at[0, 'exp']


#################################
exp = int(exp)


#################################
nbf = table.at[0, 'nbf']


#################################
nbf = int(nbf)


#################################
encoded = jwt.encode({"iss": id, "aud": url, "exp": exp, "nbf": nbf}, key, algorithm='RS256')


#################################
s=str(encoded,'utf-8')

data = StringIO(s) 

df=pandas.read_csv(data,header=None)


#################################
Alteryx.write(df,1)

 

 

 

 

 

The problem is when I try to encode a JWT using the RS256 algorithm: encoded = jwt.encode({"iss": id, "aud": url, "exp": exp, "nbf": nbf}, key, algorithm='RS256'), It spits back out this error message: NotImplementedError: Algorithm 'RS256' could not be found. Do you have cryptography installed?

the Cryptography package should be installed since I specified [crypto] when choosing the package name: pyjwt[crypto] – source: Installation — PyJWT 2.7.0 documentation. I also tried installing it separately by adding ##Package.installPackages(package="cryptography",install_type="install --proxy proxy.server:port") but still got the same error.

1 REPLY 1
bomeers
5 - Atom

finally found the answer. For one, my package install code was commented out... whoops 😂. Second, I had to update the package install line to set and trust the proxy:


Package.installPackages(package="pyjwt[crypto]", install_type="install --trusted-host server.host.com --index-url https://server.host.com/example/path/")

similar to adding global config properties in pip

Labels