Skip to main content
Power Automate
    • Robotic process automation
    • Power Automate Desktop
    • Process advisor
    • AI Builder
    • Connectors
    • Templates
  • Pricing
    • Blog
    • Documentation
    • Roadmap
    • Self-paced learning
    • Webinar
    • Overview
    • Issues
    • Give feedback
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Register
    • ·
    • Sign In
    • ·
    • Help
    Go To
    • Microsoft Power Automate Community
    • Community News
    • News & Announcements
    • Get Help with Power Automate
    • General Power Automate Discussion
    • Connecting To Data
    • Building Flows
    • Using Flows
    • Power Automate Desktop
    • AI Builder
    • Power Automate Mobile App
    • Translation Quality Feedback
    • Share, Chat, Discuss
    • Community Chat & Announcements
    • Power Automate Cookbook
    • Off Topic Discussion
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Watch & Share Videos
    • Webinars and Video Gallery
    • MBAS Gallery 2019
    • MBAS Gallery 2020
    • Give Feedback & Share Ideas
    • Power Automate Ideas
    • Report Issues
    • I Found A Bug
    • Find & Join Local User Groups
    • Power Automate User Groups
    • Read & Share Blogs
    • Power Automate Community Blog
    • Community Blog Topic Suggestions
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power Automate Community
    • Share, Chat, Discuss
    • Power Automate Cookbook
    • Parse a bearer token using Flow

    Parse a bearer token using Flow

    01-08-2020 11:12 AM

    Microsoft svarukala
    Microsoft
    1577 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    svarukala
    Microsoft svarukala
    Microsoft
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    Parse a bearer token using Flow

    ‎01-08-2020 11:12 AM

    A simple button (manual) flow that can parse a bearer token to extract details like:

    • Issuer
    • AppID
    • Audience
    • TokenSubject
    • TokenSender etc.

    Note that a HTTP based flow won't execute when you pass a bearer token in the Authorization header. You can send it as a normal POST body or a parameter instead and use that as a layer of security so that Flow can validate the token and only then execute.

    Preview file
    23 KB
    Parsebearertoken_20191217183437.zip
    Labels:
    • Labels:
    • Button Flows
    Message 1 of 4
    1,577 Views
    4 Kudos
    Reply
    • All posts
    • Previous Topic
    • Next Topic
    liansc
    liansc
    Frequent Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎01-14-2021 01:56 AM

    Hi, I incorporated this in one of my flows to extract, decode, and parse a JWT and it works great, however I encounter an error with certain JWT values. After decodeBase64, I get an Unexpected character at the end of the nbf claim, so the ParseJSON action produces an error:

    The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value cannot be parsed: 'Unexpected character encountered while parsing number: �. Path 'nbf', line 1, position 426.'.

    The output of decodeBase64() is as follows, and it doesn't have a closing brace:

    {"iat":xxx,"ver":"xxx","appid":"xxx","sub":"xxx","appidacr":"x","acr":"x","tid":"xxx","sender":"xxx","oid":"xxx","iss":"xxx","aud":"xxx","exp":1610614832,"nbf":161061393�

    In other cases, it works fine. Any idea what could be wrong? Thanks.

    Message 2 of 4
    229 Views
    0 Kudos
    Reply
    liansc
    liansc
    Frequent Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎01-14-2021 03:46 AM

    Figured it out - decodeBase64() expects the input's length to be divisible by 4, so as a workaround, I just appended (one or more) '=' characters to my token before decoding. Works ok now.

    Message 3 of 4
    223 Views
    1 Kudo
    Reply
    svarukala
    Microsoft svarukala
    Microsoft
    In response to liansc
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎01-19-2021 04:40 PM

    @liansc looks like an edge case scenario, but good tshooting. 

    Message 4 of 4
    185 Views
    0 Kudos
    Reply
    Preview Exit Preview

    never-displayed

    You must be signed in to add attachments

    never-displayed

    Additional options
    You do not have permission to remove this product association.
     

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Automate
    • Power Virtual Agents
    • Sign up free
    • Sign in

    Browse

    • Templates
    • Connectors
    • Partners

    Downloads

    • Mobile
    • Gateway

    Learn

    • Documentation
    • Learn
    • Support
    • Community
    • Give feedback
    • Blog
    • Pricing
    • © 2021 Microsoft
    • Twitter
    • RSS Feed
    • YouTube
    • Contact us
    • Trademarks
    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Terms & conditions