Confused about signing JWT

Thank you for your help, you were certainly right. There was also an issue with my script where it printed the JWT in byte format (b’token’). For future reference I solved this by decoding the result in utf-8.
(result = result.decode(“utf-8”)). Just in case anyone stumbles upon this with a similar problem.