Forum Discussion
Error while creating Access token for Power BI REST API
Hi Anonymous Thank you. This method is working and I am generating an access token.
I still have some issues though, that is, when I use this token as Bearer token for REST API, I am getting a 401 Error.
This is the request that I tried with the generated Access Token
Hey Anonymous, I am happy that now is working! You can be sure this is the right way to generate a token to authorize PBI REST API.
The problem here is that you have to setup the right permission in PBI. As you can see from the documentation: Gateways - Get Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Learn there are permission, scope and limitations that you have to take into account.
I never worked with datasource and gateway in PBI so I do not in this specific situation how to set up this permission, but that's the problem you have to solve.
I suggest you to accept the previous solution and open another post, since this is not anymore about an Access Token. I am sure community will help you in setting up the right permission if you will have problems in doing so.
Thanks!