Forum Discussion

ayazbedrekar's avatar
ayazbedrekar
New Member
4 years ago

Get Access Token

 

As per below video , need to update the token every 1 hour & write the query accordinlgy but 
https://www.youtube.com/watch?v=cTqFNg_y9lw&list=PLL-WSn9hvefogtxxi7CJhjLCJvrDY0mpQ 

But In blank query :  Get access token.

********************************************************************************************************
let
body = "grant_type=password&resource=https://analysis.windows.net/powrebi/api&client_id=ourTenantId&[email protected]&password=abcd",
Data= Web.Contents("https://login.microsoftonline.com/common/oauth2/token/",
[
Headers=[#"Content-Type"="application/x-www-form-urlencoded"],
Content=Text.ToBinary(body)


])

in
Data
******************************************************************************************************************
 we are getting problem with trying to access data from API service & getting below error.
DataSource.Error: Web.Contents failed to get contents from (400): Bad Request

so request you please let me know is there any change in query, resource link or web link or script? Could you help me build this function or share some example?

please findbelow screen shot.

 

 

 

already gone throgh below links:

 

https://community.powerbi.com/t5/Developer/REST-API-Get-Access-Token/m-p/1895937#M29924 

https://community.powerbi.com/t5/Developer/Power-BI-REST-API-using-postman-generate-embed-token/m-p/310054 

2 Replies