cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

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

  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

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

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

Hi @rohitjadhav123 ,

 

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/


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Power Virtual Agents Course: https://udemy.com/pva-beginners

View solution in original post

6 REPLIES 6
Highlighted
Super User
Super User

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

Hi @rohitjadhav123 ,

 

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-var...

 

---
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/


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Power Virtual Agents Course: https://udemy.com/pva-beginners
Highlighted
Advocate II
Advocate II

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?

Highlighted
Super User
Super User

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

@rohitjadhav123 ,

 

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/


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Power Virtual Agents Course: https://udemy.com/pva-beginners
Highlighted
Super User
Super User

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

Hi @rohitjadhav123 ,

 

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/


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Power Virtual Agents Course: https://udemy.com/pva-beginners

View solution in original post

Highlighted
Frequent Visitor

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

Hello @rohitjadhav123 .

 

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"
    }
  }
}
Highlighted
Frequent Visitor

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. 

Helpful resources

Announcements
PVA Multi Language

Power Virtual Agents Gaining Traction

Power Virtual Agents is now available in more languages.

PVA Bot Variables

Power Virtual Agents Bot Variables

Reusing variables across topics, and setting variable values from external sources.

BOT Sharing Gallery

BOT Sharing Gallery is now LIVE!

Want to Share a ChatBot? Post it in our Bot Sharing Gallery!

PVA Thumb

Video of the Week

Travel Approval Bot

PVA Thumb

Video of the Week

Returning an image as a message

Top Solution Authors
Top Kudoed Authors
Users online (5,735)