<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: REST API Authorization in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/REST-API-Authorization/m-p/2138485#M32401</link>
    <description>&lt;P&gt;You are not mentioning which way you want to authenticate. The preferred way seems to be OATH2 via custom connector&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/power-query/handlingauthentication#implementing-an-oauth-flow" target="_blank"&gt;Handling authentication for Power Query connectors | Microsoft Docs&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Oct 2021 19:51:51 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2021-10-16T19:51:51Z</dc:date>
    <item>
      <title>REST API Authorization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/REST-API-Authorization/m-p/2136996#M32389</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I'm trying the REST API, I haven't done this before and the M and DAX languages ​​are weird to me. I tried this on a postman I got this to work well. I tried looking for instructions to do this in Power BI, but that key makes it difficult.&lt;BR /&gt;Here is a view of postman javascript, showing that key how to create. Is there any way to make this work in Power BI?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp; pm.request.headers.add({key: 'X-Fivaldi-Partner', value: 'ws-XXXX'});&lt;BR /&gt;&lt;BR /&gt;let bodyMD5 = '';&lt;BR /&gt;let contentType = '';&lt;BR /&gt;&lt;BR /&gt;if (request.data.length &amp;gt; 0) {&lt;BR /&gt;bodyMD5 = CryptoJS.MD5(request.data);&lt;BR /&gt;contentType = request.headers['content-type'];&lt;BR /&gt;}&lt;BR /&gt;let time = Math.floor(new Date().getTime() / 1000).toString();&lt;BR /&gt;pm.request.headers.add({key: 'X-Fivaldi-Timestamp', value: time});&lt;BR /&gt;&lt;BR /&gt;let stringToSign = request.method + LF +&lt;BR /&gt;bodyMD5 + LF +&lt;BR /&gt;contentType + LF;&lt;BR /&gt;&lt;BR /&gt;let headers = pm.request.headers.all();&lt;BR /&gt;&lt;BR /&gt;headers.sort(function (a, b) {&lt;BR /&gt;return a.key.toLowerCase().localeCompare(b.key.toLowerCase());&lt;BR /&gt;}).forEach(function(header) {&lt;BR /&gt;if (header.key.startsWith('X-Fivaldi')) {&lt;BR /&gt;let key = header.key.trim().toLowerCase();&lt;BR /&gt;let value = header.value;&lt;BR /&gt;&lt;BR /&gt;if (typeof value === 'string') {&lt;BR /&gt;value = value.trim();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;stringToSign += key + ':' + value + LF;&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;let url = request.url.replace('http://', '').replace('https://', '');&lt;BR /&gt;let path = '';&lt;BR /&gt;let queryStr = '';&lt;BR /&gt;&lt;BR /&gt;if (url.includes('?')) {&lt;BR /&gt;path = url.substring(url.indexOf('/'), url.indexOf('?'));&lt;BR /&gt;queryStr = LF + encodeURI(url.substring(url.indexOf('?') +1));&lt;BR /&gt;} else {&lt;BR /&gt;path = url.substring(url.indexOf('/'));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;stringToSign += path + queryStr;&lt;BR /&gt;console.log(stringToSign);&lt;BR /&gt;&lt;BR /&gt;stringToSign = CryptoJS.enc.Utf8.parse(stringToSign);&lt;BR /&gt;//let key1 = CryptoJS.enc.Utf8.parse(pm.variables.get('partnerSecret'));&lt;BR /&gt;let key = CryptoJS.enc.Utf8.parse('xxxxxxxx');&lt;BR /&gt;&lt;BR /&gt;console.log(key);&lt;BR /&gt;//console.log(key1);&lt;BR /&gt;let hash = CryptoJS.HmacSHA256(stringToSign, key);&lt;BR /&gt;let signature = 'Fivaldi ' + CryptoJS.enc.Base64.stringify(hash);&lt;BR /&gt;pm.request.headers.add({key: 'Authorization', value: signature});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 09:12:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/REST-API-Authorization/m-p/2136996#M32389</guid>
      <dc:creator>I_ia</dc:creator>
      <dc:date>2021-10-15T09:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Authorization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/REST-API-Authorization/m-p/2138485#M32401</link>
      <description>&lt;P&gt;You are not mentioning which way you want to authenticate. The preferred way seems to be OATH2 via custom connector&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/power-query/handlingauthentication#implementing-an-oauth-flow" target="_blank"&gt;Handling authentication for Power Query connectors | Microsoft Docs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2021 19:51:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/REST-API-Authorization/m-p/2138485#M32401</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-10-16T19:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Authorization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/REST-API-Authorization/m-p/2147941#M32515</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Actually, I don’t know what is the best (or only) way to do authentication, in this case.&lt;BR /&gt;I like to do desktop (connection and reports) and publish in O365, adding a scheduled update, if is it possible?!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If I make a desktop, does that mean M ​​or DAX language? If so, are there instructions for this type authentication.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't used OAuth2, so I need to learn more about it&lt;/SPAN&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 10:38:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/REST-API-Authorization/m-p/2147941#M32515</guid>
      <dc:creator>I_ia</dc:creator>
      <dc:date>2021-10-21T10:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Authorization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/REST-API-Authorization/m-p/2148021#M32517</link>
      <description>&lt;P&gt;Has to be in M, the instructions and sample are in the link I posted.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 11:42:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/REST-API-Authorization/m-p/2148021#M32517</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-10-21T11:42:28Z</dc:date>
    </item>
  </channel>
</rss>

