I'm trying to implement Power Bi Embedded, to achieve that I have to authenticate with Azure Active Directory (AAD). That's where I'm stuck, I don't know what the steps are to achieve that.
For what I've been reading in the Azure docs, and because of my stack, the type of authentication that fits with my flow is OAuth 2.0 on-behalf-of-flow. This, because I have my SPA written on Angular and we handle many transactions with Cloud Functions (Firebase). So, what we want is:
- The SPA tries to embed a report
- The SPA request an embed token to the cloud functions
- The cloud functions, first, must create an access token from AAD
- Once created the access token, request to Power Bi API generate an embed token
- Returns embed token
Basically, where I'm lost is in point 3. I haven't really understand how should I request an access token so I can continue with the flow. I've found a Js library called ADAL (Active Directory Authentication Library) for Js and for what I've read, it implements the Implicit grant flow.
So, what I need is any help and/or clues in how to retrieve an access token from AAD with Javascript?