Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

How to generate the authorization code and the access token to embed Powerbi in WebApplication

I am trying to embed the Powerbi report in a web application. As the initial step I am trying to generate the access token to embed. As specified, I need to invoke a REST API for "Request an autho...
  • v-micsh-msft's avatar
    8 years ago

    Hi,

     

    Have you checked the following article?

    How To: Get embed token using Get/Post only

    The call to generate Access Token should be

    "

    POST: https://login.microsoftonline.com/common/oauth2/token
    data: {
        grant_type: password
        scope: openid
        resource: https://analysis.windows.net/powerbi/api
        client_id: {Client ID}
        username: {PBI Account Username}
        password: {PBI Account Username}
    }
    
    --Returns Json:
     
    {
        "token_type": "Bearer",
        "scope": "Report.Read.All ...",
        "expires_in": "xxxx",
        "ext_expires_in": "0",
        "expires_on": "xxxxxxxxxx",
        "not_before": "xxxxxxxxxxx",
        "resource": "https://analysis.windows.net/powerbi/api",
        "access_token": "eyJ0eXAi...",
        "refresh_token": "AQABA...",
        "id_token": "eyJ...."
    }

    "

    The resource should be 

    https://analysis.windows.net/powerbi/api

    Make sure you have specified the other data part correctly.

    for the process, please also check the document below:

    Step 2: Get n authentication access token

     

    Regards,

    Michael