Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello Folks,
I am completely new to the API calls and M code, please help me to resolve the access token refresh issue.
I am trying to create a function in Power BI query editor to refresh the access token for an API call and I get error saying
"DataSource.Error: Web.Contents failed to get contents from 'https://login.microsoftonline.com/common/oauth2/token/' (400): Bad Request
Details:
DataSourceKind=Web
DataSourcePath=https://login.microsoftonline.com/common/oauth2/token
Url=https://login.microsoftonline.com/common/oauth2/token/ "
below is the M code
let
body = "grant_type=password&resource=https://analysis.windows.net/powerbi/api&client_id=******&username=**@**.com&password=*****",
Data=Web.Contents("https://login.microsoftonline.com/common/oauth2/token/",
[
Headers=[#"Content-Type"="application/x-www-form-urlencoded"],
Content=Text.ToBinary(body)
])
in
Data
Can you please shed some light or help me out in fixing the above error.
Thank you
Hi @sqlguru448 ,
You could refer the topics which have the same issue.
https://community.powerbi.com/t5/Desktop/Bad-Request-in-Power-Query/m-p/20471
Best Regards,
Jay
Anybody, please help?
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 43 | |
| 38 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 67 | |
| 66 | |
| 31 | |
| 28 | |
| 24 |