Skip to main content

Notifications

Copilot Studio - Calling Actions from Copilot S...
Answered

How to parse auth token and get user details in PVA bot?

(2) ShareShare
ReportReport
Posted on by
  1. I have configured user auth as mentioned here on my PVA bot.
  2. I have configured Flow to send a token from PVA bot to flow.
  3. I am able to verify that my flow is able to receive a token ( after user sign in ) from PVA variable. ( seen in the screenshot bellow. )
  4. I would like to know how can I parse this token and, get the user details of sign in user? I know I can call all MS graph APIs using this token but, that is not I am trying to do here.
  5. I would like to parse this token, something like what https://jwt.io/ does.

 

Screen Shot 2020-03-19 at 2.45.40 PM.pngScreen Shot 2020-03-19 at 2.48.52 PM.pngScreen Shot 2020-03-19 at 2.51.49 PM.png

  • POJA85 Profile Picture
    POJA85 on at
    Re: How to parse auth token and get user details in PVA bot?

    As a solution I setup a Azure function to take the token, decode it and used regex to retrieve the value I needed. 

  • POJA85 Profile Picture
    POJA85 on at
    Re: How to parse auth token and get user details in PVA bot?

    Hello @Anonymous .

     

    I am struggling with exactly the same case as you, did you find a solution to this issue? 

     

    I tried to suggestion to use graph api and call https://graph.microsoft.com/v1.0/me with the token but I get error:

    {
      "error": {
        "code""InvalidAuthenticationToken",
        "message""Access token validation failure. Invalid audience.",
        "innerError": {
          "date""2020-06-19T12:57:36",
          "request-id""ed87e114-ffe2-4ae2-b52c-5e41774ae2ff"
        }
      }
    }
  • Verified answer
    CU22081450-0 Profile Picture
    CU22081450-0 on at
    Re: How to parse auth token and get user details in PVA bot?

    Hi @Anonymous ,

     

    Did I answer your question?

    If yes, please give kudos. And if this solves your problem, please accept this reply as the solution.

     

    -----

    Thanks!
    Renato Romão
    https://www.linkedin.com/in/renatoromao/

  • CU22081450-0 Profile Picture
    CU22081450-0 on at
    Re: How to parse auth token and get user details in PVA bot?

    @Anonymous ,

     

    This one: https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=http

     

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

    Thanks!
    Renato Romão
    https://www.linkedin.com/in/renatoromao/

  • Re: How to parse auth token and get user details in PVA bot?

    What the specific graph api we should use to fetch the user details from token?

  • CU22081450-0 Profile Picture
    CU22081450-0 on at
    Re: How to parse auth token and get user details in PVA bot?

    Hi @Anonymous ,

     

    The unique way to do it is by calling the Power Automate passing the AuthToken and inside your Power Automate, call back-end APIs to get more details related to the user.

    I recommend that call the MS Graph to get more details, it is an easy and great way.

    https://docs.microsoft.com/en-us/power-virtual-agents/advanced-end-user-authentication#authtoken-variable

     

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

    Thanks!
    Renato Romão
    https://www.linkedin.com/in/renatoromao/

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,666

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,996

Leaderboard

Featured topics