Forum Discussion

Amar-Agnihotri's avatar
Amar-Agnihotri
Resolver I
4 years ago
Solved

Invalid Grant error while accessing POST request for Power BI Rest API .

Hi ,  I am trying to generate access token to access data through PBI API. I am using grant_type = authorization_code. I am following each and every step given in the below article -  https://www.s...
  • V-lianl-msft's avatar
    4 years ago

    Hi Amar-Agnihotri ,

     

    According to your description, you are calling Power BI REST API From Postman.

    Did you add a Client Secret that will be displayed as the Value (not the Secret ID) in the Client Secrets section?

    To set Postman up for use with various kinds of requests that you will be mailing off, set up Environment variables and Collections. (You can read up on Collections and Environment and other facilities in the documentation.)

    For more details, please refer to :

    https://www.csgpro.com/blog/power-bi-rest-apis/ 

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Amar-Agnihotri's avatar
    4 years ago

    Hello,

    I made few changes in API call and the result is achieved -

     

    See the changes in POST Request -

     

     

    By this way we can get access token using Authorization Code

     

    To know all about the authorization code from scratch click this link-

    https://www.sqlshack.com/how-to-access-power-bi-rest-apis-programmatically/

     

    There is way using id and password also to call REST API but that methode will never be preferred. Always try to follow the Authorization code method.

     

    To know more about creating an admin panel follow this BI ELITE link -

     

    https://www.youtube.com/watch?v=cTqFNg_y9lw&list=PLL-WSn9hvefogtxxi7CJhjLCJvrDY0mpQ