<?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: Convert our api integration using API key to 0Auth 2.0 in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Convert-our-api-integration-using-API-key-to-0Auth-2-0/m-p/352075#M34535</link>
    <description>&lt;P&gt;Hi JohnJohn,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OAuth involves more than just tweaking the existing API request. You need to get an access token from HubSpot that you can include in the header of your API requests. To do this you need to go through a multipart handshake in which you request a token and a secret for a given set of scopes, and provide a callback. Then you send the user to HubSpot so they can auth and your callback gets called when they are done. Then you use the authorization code you get back to request an access token which you use to validate API requests. You will also need to manage keeping the token refreshed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is why people usually prefer to use a wrapper that handles all of this for them. For example, I've had success with &lt;A href="https://github.com/andreassolberg/jso" target="_blank" rel="noopener"&gt;JSO&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to roll it yourself, that's also feasible but it's a bit of work. I recommend starting with &lt;A href="https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2" target="_blank" rel="noopener"&gt;Digital Ocean's guide on Oauth2&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jul 2020 03:46:00 GMT</pubDate>
    <dc:creator>HenryCipolla</dc:creator>
    <dc:date>2020-07-06T03:46:00Z</dc:date>
    <item>
      <title>Convert our api integration using API key to 0Auth 2.0</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Convert-our-api-integration-using-API-key-to-0Auth-2-0/m-p/351491#M34480</link>
      <description>&lt;P&gt;I have implemented many integrations with hubspot API using api key (less secure) approach, for example inside my asp.net c# application i have the following code to integrate with hubspot api to get the companies:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; {
    wc.Encoding = Encoding.UTF8;
    string url = "https://api.hubapi.com/companies/v2/companies/paged?hapikey=3*****ff&amp;amp;properties=website&amp;amp;properties=mse_scan&amp;amp;properties=phone&amp;amp;limit=" + Program.apilimit.ToString() + "&amp;amp;offset=" + offset;
    string tempurl = url.Trim();
    string json = wc.DownloadString(tempurl);
    ipfd = JsonConvert.DeserializeObject&amp;lt;Marketing&amp;gt;(json);
    offset = ipfd.offset;
    hasmore = ipfd.hasmore;
}&lt;/PRE&gt;&lt;P&gt;now i want to convert the api key appraoch to 0Auth 2.0. so i did the following steps:-&lt;/P&gt;&lt;P&gt;1) create a new developer account.&lt;/P&gt;&lt;P&gt;2) i get the app id and client secret.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but not sure what i need to modifiy inside my above code to implement the 0Auth 2.0?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 22:56:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Convert-our-api-integration-using-API-key-to-0Auth-2-0/m-p/351491#M34480</guid>
      <dc:creator>johnjohn</dc:creator>
      <dc:date>2020-07-01T22:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Convert our api integration using API key to 0Auth 2.0</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Convert-our-api-integration-using-API-key-to-0Auth-2-0/m-p/351632#M34500</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/137362"&gt;@johnjohn&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've found a resource here that may assist, &lt;A href="https://github.com/hubspot-net/HubSpot.NET" target="_blank" rel="noopener"&gt;take a look here&lt;/A&gt;. This documents a .NET wrapper and runs through how to make the authentication request using OAuth.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 10:34:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Convert-our-api-integration-using-API-key-to-0Auth-2-0/m-p/351632#M34500</guid>
      <dc:creator>Willson</dc:creator>
      <dc:date>2020-07-02T10:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert our api integration using API key to 0Auth 2.0</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Convert-our-api-integration-using-API-key-to-0Auth-2-0/m-p/351643#M34503</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/72929"&gt;@Willson&lt;/a&gt;&amp;nbsp; thanks for the reply, but i prefer to wirte my own OAuth code , instead of using a wrapper? any advice?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 11:23:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Convert-our-api-integration-using-API-key-to-0Auth-2-0/m-p/351643#M34503</guid>
      <dc:creator>johnjohn</dc:creator>
      <dc:date>2020-07-02T11:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Convert our api integration using API key to 0Auth 2.0</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Convert-our-api-integration-using-API-key-to-0Auth-2-0/m-p/352075#M34535</link>
      <description>&lt;P&gt;Hi JohnJohn,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OAuth involves more than just tweaking the existing API request. You need to get an access token from HubSpot that you can include in the header of your API requests. To do this you need to go through a multipart handshake in which you request a token and a secret for a given set of scopes, and provide a callback. Then you send the user to HubSpot so they can auth and your callback gets called when they are done. Then you use the authorization code you get back to request an access token which you use to validate API requests. You will also need to manage keeping the token refreshed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is why people usually prefer to use a wrapper that handles all of this for them. For example, I've had success with &lt;A href="https://github.com/andreassolberg/jso" target="_blank" rel="noopener"&gt;JSO&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to roll it yourself, that's also feasible but it's a bit of work. I recommend starting with &lt;A href="https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2" target="_blank" rel="noopener"&gt;Digital Ocean's guide on Oauth2&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 03:46:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Convert-our-api-integration-using-API-key-to-0Auth-2-0/m-p/352075#M34535</guid>
      <dc:creator>HenryCipolla</dc:creator>
      <dc:date>2020-07-06T03:46:00Z</dc:date>
    </item>
  </channel>
</rss>

