<?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 Issue with refreshing Google Business authorization key in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Issue-with-refreshing-Google-Business-authorization-key/m-p/1612251#M4293</link>
    <description>&lt;P&gt;Hi, I'm trying to run the following script in order to refresh my authorization key for a Google Business account. I can use the playground to obtain it manually, but obviously I need to be able to automate it in Qlik Sense.&lt;/P&gt;&lt;P&gt;I have changed the client id, client secret and refresh token secrets for this post, but there are real values there in the actual code&lt;/P&gt;&lt;P&gt;SET vClient_id = '&lt;EM&gt;client id&lt;/EM&gt;';&lt;BR /&gt;SET vClient_secret = '&lt;EM&gt;client secret&lt;/EM&gt;';&lt;/P&gt;&lt;P&gt;SET vRefresh_token = '&lt;EM&gt;refresh token&lt;/EM&gt;';&lt;/P&gt;&lt;P&gt;LET vRequestBody ='';&lt;BR /&gt;LET vRequestBody = vRequestBody &amp;amp; 'grant_type=refresh_token';&lt;BR /&gt;LET vRequestBody = vRequestBody &amp;amp; '&amp;amp;client_id=' &amp;amp; '$(vClient_id)';&lt;BR /&gt;LET vRequestBody = vRequestBody &amp;amp; '&amp;amp;client_secret=' &amp;amp; '$(vClient_secret)';&lt;BR /&gt;LET vRequestBody = vRequestBody &amp;amp; '&amp;amp;refresh_token=' &amp;amp; '$(vRefresh_token)';&lt;/P&gt;&lt;P&gt;LIB CONNECT TO 'Google Authorization';&lt;/P&gt;&lt;P&gt;access_token:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;"access_token",&lt;BR /&gt;"token_type",&lt;BR /&gt;"expires_in"&lt;BR /&gt;FROM JSON (wrap on) "root"&lt;BR /&gt;WITH CONNECTION (&lt;BR /&gt;URL "&lt;A href="https://accounts.google.com/o/oauth2/token" target="_blank"&gt;https://accounts.google.com/o/oauth2/token&lt;/A&gt;",&lt;BR /&gt;HTTPHEADER "Content-Type" "application/x-www-form-urlencoded",&lt;BR /&gt;BODY "$(vRequestBody)"&lt;BR /&gt;)&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;LET vAccessToken = peek('access_token',0,'access_token');&lt;/P&gt;&lt;P&gt;I get the following error message:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;HTTP protocol error 400 (Bad Request): { "error": "invalid_grant", "error_description": "Bad Request" }&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I feel there could be a setting on the Google Business side that I need to make, but I cannot find any resources that tells me what that is. And as I said, it works fine in playground to get a new authorization code.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2019 06:47:56 GMT</pubDate>
    <dc:creator>niclaz79</dc:creator>
    <dc:date>2019-08-14T06:47:56Z</dc:date>
    <item>
      <title>Issue with refreshing Google Business authorization key</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Issue-with-refreshing-Google-Business-authorization-key/m-p/1612251#M4293</link>
      <description>&lt;P&gt;Hi, I'm trying to run the following script in order to refresh my authorization key for a Google Business account. I can use the playground to obtain it manually, but obviously I need to be able to automate it in Qlik Sense.&lt;/P&gt;&lt;P&gt;I have changed the client id, client secret and refresh token secrets for this post, but there are real values there in the actual code&lt;/P&gt;&lt;P&gt;SET vClient_id = '&lt;EM&gt;client id&lt;/EM&gt;';&lt;BR /&gt;SET vClient_secret = '&lt;EM&gt;client secret&lt;/EM&gt;';&lt;/P&gt;&lt;P&gt;SET vRefresh_token = '&lt;EM&gt;refresh token&lt;/EM&gt;';&lt;/P&gt;&lt;P&gt;LET vRequestBody ='';&lt;BR /&gt;LET vRequestBody = vRequestBody &amp;amp; 'grant_type=refresh_token';&lt;BR /&gt;LET vRequestBody = vRequestBody &amp;amp; '&amp;amp;client_id=' &amp;amp; '$(vClient_id)';&lt;BR /&gt;LET vRequestBody = vRequestBody &amp;amp; '&amp;amp;client_secret=' &amp;amp; '$(vClient_secret)';&lt;BR /&gt;LET vRequestBody = vRequestBody &amp;amp; '&amp;amp;refresh_token=' &amp;amp; '$(vRefresh_token)';&lt;/P&gt;&lt;P&gt;LIB CONNECT TO 'Google Authorization';&lt;/P&gt;&lt;P&gt;access_token:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;"access_token",&lt;BR /&gt;"token_type",&lt;BR /&gt;"expires_in"&lt;BR /&gt;FROM JSON (wrap on) "root"&lt;BR /&gt;WITH CONNECTION (&lt;BR /&gt;URL "&lt;A href="https://accounts.google.com/o/oauth2/token" target="_blank"&gt;https://accounts.google.com/o/oauth2/token&lt;/A&gt;",&lt;BR /&gt;HTTPHEADER "Content-Type" "application/x-www-form-urlencoded",&lt;BR /&gt;BODY "$(vRequestBody)"&lt;BR /&gt;)&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;LET vAccessToken = peek('access_token',0,'access_token');&lt;/P&gt;&lt;P&gt;I get the following error message:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;HTTP protocol error 400 (Bad Request): { "error": "invalid_grant", "error_description": "Bad Request" }&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I feel there could be a setting on the Google Business side that I need to make, but I cannot find any resources that tells me what that is. And as I said, it works fine in playground to get a new authorization code.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 06:47:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Issue-with-refreshing-Google-Business-authorization-key/m-p/1612251#M4293</guid>
      <dc:creator>niclaz79</dc:creator>
      <dc:date>2019-08-14T06:47:56Z</dc:date>
    </item>
  </channel>
</rss>

