Skip to main content

Notifications

Power Automate - General Discussion
Answered

how to decode jwt token with power automate

(1) ShareShare
ReportReport
Posted on by 8

Hello, I need to decode one jwt token with power automate, like this:

LuisBa_0-1670540168342.png

thank you

  • CU26090717-1 Profile Picture
    CU26090717-1 2 on at
    how to decode jwt token with power automate
    Thank you for this post.  It was a real life saver for me.
  • CWilkinson Profile Picture
    CWilkinson 25 on at
    Re: how to decode jwt token with power automate

    Hi,

     

    Yes, but it wasn't something we could do in Power Automate alone, we had to develop it in Azure Runbook Automation and use a Power Automate to capture the token and use that inline with the service we needed.

     

    Thanks,

     

    CWilkinson

  • rjwales Profile Picture
    rjwales on at
    Re: how to decode jwt token with power automate

    Did you ever manage to figure out how to do this?

  • CWilkinson Profile Picture
    CWilkinson 25 on at
    Re: how to decode jwt token with power automate

    Hi @v-bofeng-msft ,

     

    I wasn't aware you were able to decode using a variable in Power Automate.

     

    In theory, are you able to encode a JWT using Power Automate if you know the header, payload and security key? (pre-defined variables).

     

    If so, are you able to provide any assistance with this please?

     

    Thanks,

     

    Connor

  • LuisBa Profile Picture
    LuisBa 8 on at
    Re: how to decode jwt token with power automate

    Hi @v-bofeng-msft  many many thanks it's working, really many thanks.

  • Verified answer
    Re: how to decode jwt token with power automate

    Hi @LuisBa ,

     

    Please try:

    vbofengmsft_0-1670556309540.png

    json(if(
     equals(mod(length(split(variables('JWT Code'),'.')[0]),4),0),
     decodeBase64(split(variables('JWT Code'),'.')[0]),
     decodeBase64(concat(split(variables('JWT Code'),'.')[0],take('===',sub(4,mod(length(split(variables('JWT Code'),'.')[0]),4)))))
    ))
    
    json(if(
     equals(mod(length(split(variables('JWT Code'),'.')[1]),4),0),
     decodeBase64(split(variables('JWT Code'),'.')[1]),
     decodeBase64(concat(split(variables('JWT Code'),'.')[1],take('===',sub(4,mod(length(split(variables('JWT Code'),'.')[1]),4)))))
    ))

     

    vbofengmsft_1-1670556379034.png

     

    Best Regards,

    Bof

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,422

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,711

Leaderboard