generate hmac signature in service now
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2025 03:09 AM
I couldn't able to generate hmac signature which is much required in every platform for validations and no such capability is figured in service now,I don't know any one faced this issue or not.
I referred this discussion as well but its not working as per the code provided :
Highly appreciated for quick support here!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2025 04:21 AM - edited 04-18-2025 04:27 AM
the code is working as expected. The only pitfall: You need to create a custom application first, and within that custom application create the Script Include you can receive from https://gist.githubusercontent.com/vetsin/117cfe99ab0f87c1ac2d5c6387d1f7b4/raw/f4dc199b945ca56292ec0.... Then use my below code as an example. It works!
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 01:36 AM
Hi @Maik Skoddow ,
Thanks for your reply,
I tried and I can able to generate it, but the way we generate in python or go langauages it gives different value comparing to this flow what you had shared.
ex : I'm using standard lib to generate hmac in python lang
import hmac
import base64
import hashlib
secret="abcd"
payload="helloworld"
hmac_object = hmac.new(secret.encode(), payload.encode(), digestmod=hashlib.sha256)
base64_hmac = base64.b64encode(hmac_object.digest()).decode("utf-8")
generated_signature = f"sha256={hmac_object.hexdigest()}"
print(f"Generated HMAC: {generated_signature}")
the service now o/p with that script is different :
o/p : Generate HMAC from service now : 3oGXgIDz8yRpGfWMAnI0Tt5A0IfyRNlCd7dP3t6Ue0U=
Generated HMAC from python : de81978080f3f3246919f58c0272344ede40d087f244d94277b74fdede947b45
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2025 03:19 AM
Hi @Maik Skoddow ,
Thanks for your reply, I tried and I can able to generate it, but the way we generate in python or go langauages it gives different value comparing to this flow what you had shared.
ex : I'm using standard lib to generate hmac in python lang
import hmac import base64
import hashlib
secret="abcd"
payload="helloworld"
hmac_object = hmac.new(secret.encode(), payload.encode(), digestmod=hashlib.sha256)
base64_hmac = base64.b64encode(hmac_object.digest()).decode("utf-8")
generated_signature = f"sha256={hmac_object.hexdigest()}"
print(f"Generated HMAC: {generated_signature}")
the service now o/p with that script is different :
o/p : Generate HMAC from service now : 3oGXgIDz8yRpGfWMAnI0Tt5A0IfyRNlCd7dP3t6Ue0U=
Generated HMAC from python : de81978080f3f3246919f58c0272344ede40d087f244d94277b74fdede947b45
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey @ChethanB4037292 !
Your first string is base64 and your second one is hex 😉 Try converting the first string to hex or the second string to base64 and see what you get!
Mark my note as helpful and enjoy a bug free (or at least bug-lite) day✨🐛