Coinbase Pro API Authentication

I got this python code to create a working signature:

key = base64.b64decode(secret)
msg = message.encode(‘utf-8’)
ash = hmac.digest(key, msg, hashlib.sha256)
sig = base64.b64encode(ash).decode(‘utf-8’)

But when I tried it with javascript and AHK, creating the same signature, {“message”:“invalid signature”} gets returned.

Any ideas why that might be. Is there some difference in the signature string?