<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: KOR Connect </title>
    <description>The latest articles on DEV Community by KOR Connect  (@korconnect).</description>
    <link>https://dev.to/korconnect</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F4693%2F29d93b63-a14c-4ecc-9359-c571cbe8270e.png</url>
      <title>DEV Community: KOR Connect </title>
      <link>https://dev.to/korconnect</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/korconnect"/>
    <language>en</language>
    <item>
      <title>Quickest Way to Secure API Keys on the Frontend (In Minutes)</title>
      <dc:creator>KOR Connect</dc:creator>
      <pubDate>Tue, 07 Dec 2021 17:13:19 +0000</pubDate>
      <link>https://dev.to/korconnect/quickest-way-to-secure-api-keys-on-the-frontend-in-minutes-1g97</link>
      <guid>https://dev.to/korconnect/quickest-way-to-secure-api-keys-on-the-frontend-in-minutes-1g97</guid>
      <description>&lt;p&gt;There are often times when we are building websites that leverage the benefits of being delivered on a CDN (security, performance, no backend infrastructure required), but we want more powerful, dynamic functionality. The best way to increase functionality is through APIs; i.e. email contact forms, processing of outside data, or present information like the weather forecast, flight schedules, currency exchange rates, etc. How would we make these API integrations quickly and securely if we do not want to build out a backend or add infrastructure to handle these API calls? Where do we secure the private API keys? What if we don't want user authentication prior to allowing our users to interact with the 3rd party APIs? The answer is &lt;a href="https://korconnect.io/" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt;, KOR Connect is a middleware platform that allows CDN front ends to secure API Keys in a quick and simple way, while automatically deploying security layers during the API integration process. The bonus is that it is also free to use! &lt;/p&gt;

&lt;p&gt;We will talk through an example of integrating a Covid 19 tracker. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3pwd5x53btr62ogn1nrd.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3pwd5x53btr62ogn1nrd.gif" alt="Corona_Tracker_GIF"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's create a COVID-19 tracker. In order to do this, we have to pick the API that we want to use. I decided on the &lt;a href="https://rapidapi.com/axisbits-axisbits-default/api/covid-19-statistics/" rel="noopener noreferrer"&gt;COVID-19 Statistics API&lt;/a&gt; that uses data from John Hopkins University.&lt;/p&gt;

&lt;p&gt;If you already have a &lt;a href="https://korconnect.io/" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt; account you can sign in &lt;a href="https://app.korconnect.io/login" rel="noopener noreferrer"&gt;here&lt;/a&gt; or you can create a new account.&lt;br&gt;
Let’s start by creating an API connection on KOR Connect by clicking on the “+ Connect API” button:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5a5dxftj5lgyzsbskmja.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5a5dxftj5lgyzsbskmja.jpeg" alt="Connect_API"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The connection details were all copied directly from RapidAPI. More information regarding the API connection module &lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/GETSTARTED.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1v8c8a3x315oembhs6nd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1v8c8a3x315oembhs6nd.png" alt="Connection_module"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Done! After making the connection, go to View Details for your new API connection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6hlhoqbezgzdg488lt8c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6hlhoqbezgzdg488lt8c.png" alt="View_Details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you will see the Secure API and Public API key, both generated by KOR Connect. You can also adjust your per-user rate limit for your API calls at the top left of the screen (the default is 5 calls per second). In this example, we will be using the Single URL Security Type provided by KOR Connect. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F75c6wb6gsmqjylqo8hu4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F75c6wb6gsmqjylqo8hu4.png" alt="API_Details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;If you want, &lt;a href="https://www.youtube.com/watch?v=m-MAIpnH9ag" rel="noopener noreferrer"&gt;here&lt;/a&gt; is a great video tutorial by Traversy Media walking you through building the site on Vue.js. (&lt;a href="https://github.com/bradtraversy/vue-covid-tracker" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is the code for his COVID-19 tracker).&lt;/em&gt; &lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; In the tutorial he uses a public API, we will use KOR Connect to easily integrate the private API into our site.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, all you have to do is grab the Secure URL and Public API Key provided by KOR Connect (refer to the image above) and use them to make an API request. Here's an example of the fetch request.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;YOUR-SECURE-URL&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;method&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;headers&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;x-rapidapi-key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;YOUR-PUBLIC-API-KEY&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it, now you are ready to start testing/ using your API integration. KOR Connect automatically sets the Connection Mode to Testing. When you are ready to go to production make sure you remember to switch the Connection Mode to Production, this will activate security and remove localhost from the allowed domains (more information &lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/TESTINGPRODUCTIONMODES.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvea7kzfaxyteewz0e4wp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvea7kzfaxyteewz0e4wp.png" alt="Connection_Modes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was as simple as that, now your API integration works without any additional libraries or configurations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4b1i79gco4w9c625p05.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4b1i79gco4w9c625p05.jpeg" alt="Finished_Tracker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're interested in adding even more security through an attestation service, click &lt;a href="https://dev.to/korconnect/quickest-way-to-secure-api-keys-on-the-frontend-1jcp"&gt;here&lt;/a&gt; for additional instructions.&lt;/p&gt;

&lt;p&gt;In case you are interested in what happens automatically on KOR Connect’s end after you make a connection. Bot controls are activated that inspect for miscellaneous bots, security-related bots, calls coming from automated browsers, black listed origins, and user agents that don’t seem to be coming from a browser; these calls are blocked if they don’t pass inspection. Furthermore, KOR Connect validates the access-control-allow-origin header from your allowed origins, as well as provides a per-user rate limiter that can block malicious actors abusing calls without causing any interruptions to other users.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>security</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Integrate APIs Without a Backend</title>
      <dc:creator>KOR Connect</dc:creator>
      <pubDate>Thu, 02 Dec 2021 11:05:04 +0000</pubDate>
      <link>https://dev.to/korconnect/simplest-and-secure-way-to-connect-apis-on-the-frontend-942</link>
      <guid>https://dev.to/korconnect/simplest-and-secure-way-to-connect-apis-on-the-frontend-942</guid>
      <description>&lt;p&gt;When we build websites and webapps that leverage the benefits of being delivered on the CDN (benefits include security, performance, infinite scaling, no backend infrastructure required) we will often run into limitations when we want more powerful, dynamic functionality. The best way to increase functionality is through the integration of APIs. APIs give our frontends near infinite possibilities; i.e. we can easily connect contact forms, process outside data, store information, or present information like the weather forecast, flight schedules, currency exchange rates etc. One of the key benefits of having our frontend on the CDN is not having to deal with building and maintaining backend infrastructure, but how do we integrate APIs securely and easily without a backend? Where do we secure the private API keys? What if we don't want user authentication prior to allowing our users to interact with a 3rd party API? We will go through the simplest way of connecting APIs with automated security using &lt;a href="https://korconnect.io/" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt;. &lt;/p&gt;

&lt;h4&gt;
  
  
  How quickly can this be done and what happens?
&lt;/h4&gt;

&lt;p&gt;The answer is in a few quick minutes if the API you are integrating with has decent documentation, but why would you want to integrate with an API that doesn't anyways? KOR Connect does everything on the backend, and as the user we only have to copy-paste the KOR Connect public endpoint and the header into our code after entering the integrating API information into KOR Connect. Everything else is done on KOR Connect's end. &lt;/p&gt;

&lt;p&gt;Here are some of the things that happen automatically on KOR Connects end after you make a connection; bot controls are activated that inspect for, miscellaneous bots, security related bots, calls coming from automated browsers, black listed origins, and user agents that don’t seem to be coming from a browser; these calls are blocked if they don’t pass inspection. Furthermore KOR Connect validates the access-control-allow-origin header from your allowed origins, and provides a per user rate limiter that can block malicious actors abusing calls without causing any interruptions to other users. &lt;/p&gt;

&lt;p&gt;Now let’s walk through an example integrating 2 APIs into our frontend; a geolocation API and the Open Weather API.&lt;/p&gt;

&lt;h3&gt;
  
  
  KOR Connect Backendless Reactjs Application
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkh9xxlwnmdnes7yu6rx5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkh9xxlwnmdnes7yu6rx5.png" alt="KOR_Connect_image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will be giving our ReactJS frontend the ability to allow users to enter any address and get the current weather conditions alongside other details such as the wind speed, humidity and temperature. The challenge is that we are going to be using two APIs; one to translate the address into latitude and longitude, and another API to give us the weather conditions for that location. We are providing this multi API integration as an example to show that you can integrate as many APIs as you would like into a single project. You can also quickly and easily integrate just one API as well, by following along. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;This web app can be hosted on any CDN or static site service like S3, Gitlab pages, Netlify, etc.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7r7k3fcefg7884ag4h42.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7r7k3fcefg7884ag4h42.png" alt="Finished_weather_app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The APIs&lt;/strong&gt;&lt;br&gt;
Head over to &lt;a href="https://rapidapi.com/hub" rel="noopener noreferrer"&gt;Rapid API&lt;/a&gt; and subscribe to &lt;a href="https://rapidapi.com/GeocodeSupport/api/forward-reverse-geocoding/" rel="noopener noreferrer"&gt;Forward &amp;amp; Reverse Geocoding&lt;/a&gt; as well as the &lt;a href="https://rapidapi.com/community/api/open-weather-map/" rel="noopener noreferrer"&gt;Open Weather Map&lt;/a&gt;. After subscribing you'll be able to see your API Key in the Code Snippets section of each API's endpoint tab. Save that API key as well as the URL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;KOR Connect&lt;/strong&gt;&lt;br&gt;
If you already have a &lt;a href="https://app.korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt; account you can &lt;a href="https://app.korconnect.io/login" rel="noopener noreferrer"&gt;sign in&lt;/a&gt; or you can create a new account.&lt;/p&gt;

&lt;p&gt;Now from the KOR Connect dashboard select the Connect API button and fill in the form for a new connection. The only fields you need to change from the following image are the API Key and the allowed domain (choose the domain you'll be hosting your app from). The API key is the one you stored in the previous step. Optionally you can add more domains and change the name of the connection. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzikxgebrpad8xmoa3zv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftzikxgebrpad8xmoa3zv.png" alt="Geolocation_Connect_module"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Repeat the process for the Weather API connection, see the following image for more details.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdbh237f8hxkzajux805.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdbh237f8hxkzajux805.png" alt="OPEN_weather_Connect_Module"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With your connections created you are now able to enter each connection via View Details to retrieve each secure URL and header that you'll need to include in your code. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcw6vygup861z27sfy46h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcw6vygup861z27sfy46h.png" alt="View_Details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can modify the per user rate limit for your API calls at the top left of the screen. The Default is 5 calls per second. This rate limiter controls the number of calls per second, per user; so if a malicious user is attempting to increase your costs or crash your API connection that user will be blocked without causing any interference with other users. More information regarding the rate limiter &lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/RATELIMITER.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Secure URL that is generated acts similar to the API base URL, and the header is using a KOR Connect generated public API key, with these two ready, you are now able to test and use your connection. Notice the Connection Mode on the top right, you are currently on Testing which means you can access KOR Connect through localhost but once you switch to production this is blocked, read more about it in the &lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/TESTINGPRODUCTIONMODES.html" rel="noopener noreferrer"&gt;Testing and Production Modes documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There is no configuration, library or import required to use KOR Connect's Single URI feature so we can jump straight to the API calls.&lt;/p&gt;

&lt;p&gt;Here's the geolocation Axios request example where you can replace &amp;lt; SECURE-URL &amp;gt; with your secure base URL generated by KOR Connect and add the parameters you would like to have. Furthermore you can replace &amp;lt; PUBLIC-API-KEY &amp;gt; with the KOR Connect provided public API key. Here is our &lt;a href="https://gitlab.com/kor-comunity/weather-backendless-web-app/-/blob/main/src/components/Search.js#L27" rel="noopener noreferrer"&gt;code&lt;/a&gt; you can take a look at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fwdGeoLocation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SECURE&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;URL&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;q&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;accept-language&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;polygon_threshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0.0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;      
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-api-key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;PUBLIC-API-KEY&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;  
    &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;      
      &lt;span class="nx"&gt;location&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;lon&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;      
      &lt;span class="nf"&gt;getWeather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is the weather API Axios request example, following the same format as above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getWeather&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;lon&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;SECURE-URL&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;lon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;lon&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;lat&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;        
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;x-api-key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;PUBLIC-API-KEY&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;      
      &lt;span class="nf"&gt;setWeather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the Geolocation API responds successful, it stores the result in state triggering React to render the weather information that is received. If you are interested in reviewing this implementation refer to &lt;a href="https://gitlab.com/kor-comunity/weather-backendless-web-app/-/blob/main/src/components/Search.js#L10" rel="noopener noreferrer"&gt;this&lt;/a&gt; section of the code.&lt;/p&gt;

&lt;p&gt;Done! You should now have your API Keys secured and integration working. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; One thing that you might have noticed is that we're posting the URL and API key for the world to see but this is one of the advantages of KOR Connect. The KOR Connect generated API Keys are public keys and not the Open Weather or Geolocation API Keys, and the same holds true for the URL, both values are delivered by KOR to secure and obscure the actual information you want to protect. For maintainability of your code, you might want to store KOR Connect's API key and secure URL into a .env file or as env variables depending on where you're hosting it.&lt;/em&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Using KOR Connect saves a considerable amount of resources, both time and money. For an approach requiring a server, you would need to provision the infra, harden the server, add observability, keep it up to date and so on. It’s a real pain in the neck but it’s not the only option. The serverless approach is a smoother alternative, less expensive if the functions are not constantly active and easier to manage, the caveats are having to learn the vendor's serverless implementation and maintaining the runtime. With KOR Connect you can release your application once your front end is ready to go. &lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>security</category>
      <category>jamstack</category>
    </item>
    <item>
      <title>Best ways to Connect APIs on the frontend </title>
      <dc:creator>KOR Connect</dc:creator>
      <pubDate>Thu, 14 Oct 2021 17:03:59 +0000</pubDate>
      <link>https://dev.to/korconnect/best-ways-to-connect-apis-on-the-frontend-27c4</link>
      <guid>https://dev.to/korconnect/best-ways-to-connect-apis-on-the-frontend-27c4</guid>
      <description>&lt;p&gt;There are often times when we are building websites that leverage the benefits of being delivered on a CDN (security, performance, no backend infrastructure required), but we want more powerful, dynamic functionality. The best way to increase functionality is through APIs; i.e. email contact forms, processing of outside data, or present information like the weather forecast, flight schedules, currency exchange rates etc. How would we make these API integrations quickly and securely if we do not want to build out a backend or add infrastructure to handle these API calls? Where do we secure the private API keys? What if we don't want user authentication prior to allowing our users to interact with the 3rd party APIs? We will go over the best ways of executing these API integrations. Then we will provide links to some projects that walk you through how this is done via &lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt;.  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ways of integrating 3rd party APIs without backend infrastructure:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6ufft11nrvwv10knfon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6ufft11nrvwv10knfon.png" alt="Lambda image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Serverless Functions as a backend proxy (AWS Lambda):&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;It is often recommended to use serverless functions to hide API keys for client side applications. Then the client can use this serverless function as a proxy to call the API through a new endpoint. The developer should also incorporate CORS to identify the header origin so that only the allowed domains are calling the proxy (to prevent unwanted calls to the proxy url from anywhere). This may seem secure but CORS only verifies browser calls and can be easily spoofed or can be called from outside of the browser. A malicious actor can still run up costs with a bot and have the endpoint shut down. Further issues with this technique can arise around provisioning AWS services to support the lambda functions like API gateways, roles, and permissions between cloud services, this can be very time consuming if you are not familiar with the cloud provider. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0q72a1o7nbcsnp61f95k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0q72a1o7nbcsnp61f95k.jpg" alt="Netlify logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Netlify Functions (built on AWS Lambda):&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Netlify Functions is a wrapper around AWS Lambdas, the main advantage to using this approach over the AWS provisioned proxy is an improved user experience and Netlify helps streamline the deployment for you. Netlify Functions remove the tasks associated with setting up an AWS account and other AWS services required to correctly integrate the API. Similar security issues persist with Netlify Functions as they do with setting up your own AWS provisioned proxy. Even with CORS setup the new Netlify endpoint can be called in unwanted ways and by unwanted agents. This leaves your API susceptible to being shut down, or having costs run up. Furthermore if you are not familiar with writing functions this could present an additional learning curve.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffg4bj3hp3w310mkvzmcz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffg4bj3hp3w310mkvzmcz.png" alt="KOR Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt;:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;KOR Connect is a new way for client-side web apps to integrate APIs. KOR Connect is the quickest way to secure API Keys and connect 3rd party APIs because you do not need to build infrastructure (AWS/ other cloud providers), or code functions (AWS and Netlify Functions). KOR Connect also uses AWS Lambda to secure API keys but the similarities between KOR Connect and the other options end there. The API key is secured on KOR Connect through a one click integration, then a public URL and header are generated by KOR Connect that is copy- pasted into the frontend code. This third party API integration process takes less than a minute for the developer to complete and automatically comes with a number of security features. These features include bot control which inspects for: miscellaneous bots, security related bots, calls coming from automated browsers, black listed origins, and user agents that don’t seem to be coming from a browser, and blocks these calls if they don’t pass inspection. As well as validates the access-control-allow-origin header from the developer’s allowed origins, and provides a per user rate limiter that can block malicious actors abusing calls without causing any interruptions to other users. &lt;/p&gt;

&lt;p&gt;If the developer wants even more security after this simple single URL integration is completed KOR Connect offers a more robust origin validation and an attestation layer provided by Google’s Recaptcha. Depending on the framework that the developer is working with (e.g. Reactjs, Vue, Angular etc) the corresponding snippets of code that KOR Connect provides will need to be placed into the code of the project.&lt;/p&gt;

&lt;p&gt;KOR Connect prevents endpoint calls from malicious actors with and without the browser, secures API keys, and blocks bot attacks. The public URL that is used in the code does not need to be hidden so this frees the developer from having to worry about API secrets ending up in the git repository, API secrets being exposed on the client, having to manually create wrappers around lambda functions, and worrying about unwanted endpoint calls being made. The current feature set offered by KOR Connect is the best option for client-side web apps that want dynamic functionality but may not necessarily want user authentication. (Bonus it’s also free)&lt;/p&gt;

&lt;h2&gt;
  
  
  Here are some tutorial links walking you through API integrations with KOR Connect:
&lt;/h2&gt;

&lt;p&gt;Try them out! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/korconnect/free-music-downloader-api-integrated-to-frontend-in-15-minutes-4629"&gt;Music Downloader API Integrated on the Frontend&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/korconnect/quickest-way-to-secure-api-keys-on-the-frontend-1jcp"&gt;Quickest way to Secure API Keys on the Frontend&lt;/a&gt;- Building a Vue.js Covid tracker.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/korconnect/connecting-a-gif-api-on-reactjs-without-a-backend-3fj7"&gt;Connecting a gif API on ReactJS without a backend&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/korconnect/integrate-apis-with-your-html-site-without-a-backend-2303"&gt;Realtime Currency Exchange API Integration - HTML&lt;/a&gt; &lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>security</category>
      <category>jamstack</category>
    </item>
    <item>
      <title>Music Downloader API Secured on the Frontend</title>
      <dc:creator>Clemenshemmerling</dc:creator>
      <pubDate>Mon, 11 Oct 2021 19:37:24 +0000</pubDate>
      <link>https://dev.to/korconnect/free-music-downloader-api-integrated-to-frontend-in-15-minutes-4629</link>
      <guid>https://dev.to/korconnect/free-music-downloader-api-integrated-to-frontend-in-15-minutes-4629</guid>
      <description>&lt;p&gt;This YouTube music download API integration is done on the client side without a backend (I did not want to deal with backend infrastructure to hide the API key). I used &lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt; as the middleware platform (free) to quickly and easily integrate the API in a secure way. Firstly I will go over why I chose this route. &lt;/p&gt;

&lt;p&gt;We all know that API keys and connections can not be secured on the client side of an application. Hard coding API keys on the frontend is a quick and surefire way to have your API connection shutdown, API keys stolen, and have your API provider’s bill skyrocket. So what options are there if you do not want to maintain back end infrastructure? I will explore the recommended techniques for integrating 3rd party APIs into client side applications without having to build a backend. Then I will walk you through a step by step example of integrating YouTube’s private API to download music for free using &lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt;.   &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ways of integrating 3rd party APIs without backend infrastructure:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6ufft11nrvwv10knfon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6ufft11nrvwv10knfon.png" alt="Lambda image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Serverless Functions as a backend proxy (AWS Lambda):&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;It is often recommended to use serverless functions to hide API keys for client side applications. Then the client can use this serverless function as a proxy to call the API through a new endpoint. The developer should also incorporate CORS to identify the header origin so that only the allowed domains are calling the proxy (to prevent unwanted calls to the proxy url from anywhere). This may seem secure but CORS only verifies browser calls and can be easily spoofed or can be called from outside of the browser. A malicious actor can still run up costs with a bot and have the endpoint shut down. Further issues with this technique can arise around provisioning AWS services to support the lambda functions like API gateways, roles, and permissions between cloud services, this can be very time consuming if you are not familiar with the cloud provider. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0q72a1o7nbcsnp61f95k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0q72a1o7nbcsnp61f95k.jpg" alt="Netlify logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Netlify Functions (built on AWS Lambda):&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Netlify Functions is a wrapper around AWS Lambdas, the main advantage to using this approach over the AWS provisioned proxy is an improved user experience and Netlify helps streamline the deployment for you. Netlify Functions remove the tasks associated with setting up an AWS account and other AWS services required to correctly integrate the API. Similar security issues persist with Netlify Functions as they do with setting up your own AWS provisioned proxy. Even with CORS setup the new Netlify endpoint can be called in unwanted ways and by unwanted agents. This leaves your API susceptible to being shut down, or having costs run up. Furthermore if you are not familiar with writing functions this could present an additional learning curve.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffg4bj3hp3w310mkvzmcz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffg4bj3hp3w310mkvzmcz.png" alt="KOR Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt;:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;KOR Connect is a new way for client-side web apps to integrate APIs. KOR Connect is the quickest way to secure API Keys and connect 3rd party APIs because you do not need to build infrastructure (AWS/ other cloud providers), or code functions (AWS and Netlify Functions). KOR Connect also uses AWS Lambda to secure API keys but the similarities between KOR Connect and the other options end there. The API key is secured on KOR Connect through a one click integration then a snippet containing a new public URL is copy-pasted into the developer’s code. This snippet that is placed into the frontend code contains Google’s Recaptcha V3 which is used as an attestation layer to confirm the origin of the endpoint call as well as block unwanted bot traffic. KOR Connect also has additional layers of security to further protect the API traffic from man-in-the-middle attacks. KOR Connect prevents endpoint calls from malicious actors with and without the browser, secures API keys, and blocks bot attacks. The public URL that is used in the code does not need to be hidden so this frees the developer from having to worry about API secrets ending up in the git repository, API secrets being exposed on the client, having to manually create wrappers around lambda functions, and worrying about unwanted endpoint calls being made. The current feature set KOR Connect is the best option for client-side web apps that want dynamic functionality but may not necessarily want user authentication. (Bonus it’s also free)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now let’s walk through integrating YouTube’s music download API using KOR Connect and React.js!&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Let’s start with the API we want to use which is this &lt;a href="https://rapidapi.com/ytjar/api/youtube-mp36/" rel="noopener noreferrer"&gt;YouTube Mp3 API&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;If you already have a &lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt; account you can sign in &lt;a href="https://app.korconnect.io/login" rel="noopener noreferrer"&gt;here&lt;/a&gt; or you can &lt;a href="https://app.korconnect.io/SignUp" rel="noopener noreferrer"&gt;create a new account&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let’s start by creating an API connection on KOR Connect by clicking on the “+ Connect API” button. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe67o8omiy9frelsro5ub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe67o8omiy9frelsro5ub.png" alt="Connect API"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will take us to connection details. The credentials needed here are copied directly from RapidAPI (or the API's documentation). More information regarding the API connection module &lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/GETSTARTED.html" rel="noopener noreferrer"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvm9smswm6fip9xhyho6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frvm9smswm6fip9xhyho6.png" alt="Connection details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we have our API connection created we enter that connection by selecting view details.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzzoe0e4hhi2ip4f6cf58.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzzoe0e4hhi2ip4f6cf58.png" alt="View details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you would like, you can test your connection with Postman or another API testing tool.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuuq67dr9ic15n6l6d2x2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuuq67dr9ic15n6l6d2x2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you just have to copy the Single URL endpoint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9mdofxd4qtzq3skd1la.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9mdofxd4qtzq3skd1la.png" alt="CopyURL"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And don't forget to copy the Header for your call.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu2cv0pa3kbumxvez5blf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu2cv0pa3kbumxvez5blf.png" alt="CopyHeader"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we will copy the Single URL and Headers into our frontend.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const handleCreateLink = async () =&amp;gt; {
    setLoader(true);
    setInfo(null);

    let code;

    if (URL.includes("youtube.com")) {
      code = URL.replace("https://www.youtube.com/watch?v=", "");
    }

    if (URL.includes("youtu.be")) {
      code = URL.replace("https://youtu.be/", "");
    }

    /* We'll need this constant to make request */
    const timestamp = new Date().toUTCString();
    // You need to append the path of the endpoint you are calling to the KOR Connect base URI
    axios
      .get(`${process.env.REACT_APP_API_URL}/youtube-download/dl?id=${code}`, {
        headers: {
          /* Place your headers here: */
          timestamp,
          "x-api-key": process.env.REACT_APP_API_KEY,
        },
      })
      .then((response) =&amp;gt; {
        setInfo(response.data);
        setLoader(false);
        setURL("");
      })
      .catch((error) =&amp;gt; {
        console.log(error);
      });
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we are ready to deploy the project to production we have to change the Connection Mode from Test Mode to Production Mode, this will turn on additional security.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/TESTINGPRODUCTIONMODES.html" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is some additional information pertaining to Testing and Production Modes on KOR Connect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2si6c8z9ln88k7sfrok1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2si6c8z9ln88k7sfrok1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you are going to use the provided code from the project in the repo, remember that some of the values need to be modified to comply with the security layers for KOR Connect and your particular project (Connection URL, and usage token). The following image show the values that need to be changed.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0od9n5hw03tk8uvc2vd9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0od9n5hw03tk8uvc2vd9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Done! Now your application is ready to download music from YouTube, for free, and without ads. Try mine out &lt;a href="https://music-download.kor-test.com/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyjhnycnrywu02wcdtais.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyjhnycnrywu02wcdtais.png" alt="Finished app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Additional Security
&lt;/h1&gt;

&lt;p&gt;Let’s take a look at how KOR Connect provides an additional layer of security. Follow along if you would like to implement Recaptcha as an attestation layer amongst other security features.&lt;/p&gt;

&lt;p&gt;You will have to navigate to the Additional Security section within the View Details of your API connection. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fohpgbttqwz8x9frf4ef2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fohpgbttqwz8x9frf4ef2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then you will have to turn on Additional Security. When Additional Security is turned on, the Security Type should read Single URL + Additional Security.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10hd9usumcaq2llxjuew.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10hd9usumcaq2llxjuew.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, scroll down to the snippets section and you will add the corresponding snippets of code to your project, in this case we are using ReactJS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F20ddikncj9wksmkhvd2a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F20ddikncj9wksmkhvd2a.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Take a look at the following snippet:&lt;br&gt;
You will need to install some dependecies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save react-google-recaptcha-v3 axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following script to your index.js project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import ReactDOM from 'react-dom';
import {
  GoogleReCaptchaProvider,
} from 'react-google-recaptcha-v3';

ReactDOM.render(
  &amp;lt;GoogleReCaptchaProvider reCaptchaKey={process.env.REACT_APP_RECAPTCHA_KEY}&amp;gt;
    &amp;lt;App /&amp;gt;
  &amp;lt;/GoogleReCaptchaProvider&amp;gt;,
  document.getElementById('root')
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then add the following script to your App.js project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function App() {
  const [URL, setURL] = useState("");
  const [info, setInfo] = useState(null);
  const [loader, setLoader] = useState(false);

  // This constant is required for ReCaptcha, which is used by KOR Connect
  const { executeRecaptcha } = useGoogleReCaptcha();

  const handleCreateLink = async () =&amp;gt; {
    setLoader(true);
    setInfo(null);

    let code;

    if (URL.includes("youtube.com")) {
      code = URL.replace("https://www.youtube.com/watch?v=", "");
    }

    if (URL.includes("youtu.be")) {
      code = URL.replace("https://youtu.be/", "");
    }

    /* We'll need this constant to make request */
    const token = await executeRecaptcha("submit");
    const timestamp = new Date().toUTCString();
    // You need to append the path of the endpoint you are calling to the KOR Connect base URI
    axios
      .get(`${process.env.REACT_APP_API_URL}/youtube-download/dl?id=${code}`, {
        headers: {
          /* Place your headers here: */
          token,
          timestamp,
          "x-api-key": process.env.REACT_APP_API_KEY,
        },
      })
      .then((response) =&amp;gt; {
        setInfo(response.data);
        setLoader(false);
        setURL("");
      })
      .catch((error) =&amp;gt; {
        console.log(error);
      });
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, all of the API calls are made to the public URL that KOR Connect provides. KOR Connect will act as a proxy to authenticate as well as send the API information. Furthermore, thanks to reCaptcha V3 (which is implemented automatically) and additional layers of security, several malicious attack vectors are blocked which enhances KOR Connects security.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you need more information, click &lt;a href="https://github.com/Clemenshemmerling/music-download" rel="noopener noreferrer"&gt;here&lt;/a&gt; to go to the repo.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyjhnycnrywu02wcdtais.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyjhnycnrywu02wcdtais.png" alt="Finished app"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>security</category>
      <category>react</category>
    </item>
    <item>
      <title>Quick way to Secure API Keys for the Frontend</title>
      <dc:creator>Jose Torres</dc:creator>
      <pubDate>Wed, 29 Sep 2021 20:26:50 +0000</pubDate>
      <link>https://dev.to/korconnect/quickest-way-to-secure-api-keys-on-the-frontend-1jcp</link>
      <guid>https://dev.to/korconnect/quickest-way-to-secure-api-keys-on-the-frontend-1jcp</guid>
      <description>&lt;p&gt;We all know that API keys and connections can not be secured on the client side of an application. Hard coding API keys on the frontend is a quick and surefire way to have your API connection shutdown, API keys stolen, and have your API provider’s bill skyrocket. So what options are there if you do not want to maintain back end infrastructure? We will explore the recommended techniques for integrating 3rd party APIs into client side applications without having to build a backend. Then we will walk you through a step by step example of integrating a private API to create a Covid 19 tracker using &lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt;.   &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Ways of integrating 3rd party APIs without backend infrastructure:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6ufft11nrvwv10knfon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj6ufft11nrvwv10knfon.png" alt="Lambda image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Serverless Functions as a backend proxy (AWS Lambda):&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;It is often recommended to use serverless functions to hide API keys for client side applications. Then the client can use this serverless function as a proxy to call the API through a new endpoint. The developer should also incorporate CORS to identify the header origin so that only the allowed domains are calling the proxy (to prevent unwanted calls to the proxy url from anywhere). This may seem secure but CORS only verifies browser calls and can be easily spoofed or can be called from outside of the browser. A malicious actor can still run up costs with a bot and have the endpoint shut down. Further issues with this technique can arise around provisioning AWS services to support the lambda functions like API gateways, roles, and permissions between cloud services, this can be very time consuming if you are not familiar with the cloud provider. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0q72a1o7nbcsnp61f95k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0q72a1o7nbcsnp61f95k.jpg" alt="Netlify logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Netlify Functions (built on AWS Lambda):&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Netlify Functions is a wrapper around AWS Lambdas, the main advantage to using this approach over the AWS provisioned proxy is an improved user experience and Netlify helps streamline the deployment for you. Netlify Functions remove the tasks associated with setting up an AWS account and other AWS services required to correctly integrate the API. Similar security issues persist with Netlify Functions as they do with setting up your own AWS provisioned proxy. Even with CORS setup the new Netlify endpoint can be called in unwanted ways and by unwanted agents. This leaves your API susceptible to being shut down, or having costs run up. Furthermore if you are not familiar with writing functions this could present an additional learning curve.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffg4bj3hp3w310mkvzmcz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffg4bj3hp3w310mkvzmcz.png" alt="KOR Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;&lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt;:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;KOR Connect is a new way for client-side web apps to integrate APIs. KOR Connect is the quickest way to secure API Keys and connect 3rd party APIs because you do not need to build infrastructure (AWS/ other cloud providers), or code functions (AWS and Netlify Functions). KOR Connect also uses AWS Lambda to secure API keys but the similarities between KOR Connect and the other options end there. The API key is secured on KOR Connect through a one click integration then a snippet containing a new public URL is copy-pasted into the developer’s code. This snippet that is placed into the frontend code contains Google’s Recaptcha V3 which is used as an attestation layer to confirm the origin of the endpoint call as well as block unwanted bot traffic. KOR Connect also has additional layers of security to further protect the API traffic from man-in-the-middle attacks. KOR Connect prevents endpoint calls from malicious actors with and without the browser, secures API keys, and blocks bot attacks. The public URL that is used in the code does not need to be hidden so this frees the developer from having to worry about API secrets ending up in the git repository, API secrets being exposed on the client, having to manually create wrappers around lambda functions, and worrying about unwanted endpoint calls being made. The current feature set KOR Connect is the best option for client-side web apps that want dynamic functionality but may not necessarily want user authentication. (Bonus it’s also free)&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Now let's walk through an example using KOR Connect and Vue.js!&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivbhc4t0wbj9p1n73ued.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivbhc4t0wbj9p1n73ued.gif" alt="gif"&gt;&lt;/a&gt;&lt;br&gt;
Lets create a COVID-19 tracker. In order to do this we have to pick the API that we want to use. I decided on the &lt;a href="https://rapidapi.com/axisbits-axisbits-default/api/covid-19-statistics/" rel="noopener noreferrer"&gt;COVID-19 Statistics API&lt;/a&gt; that uses data from John Hopkins University.  &lt;/p&gt;

&lt;p&gt;If you already have a &lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt; account you can sign in &lt;a href="https://app.korconnect.io/login" rel="noopener noreferrer"&gt;here&lt;/a&gt; or you can create a new account.&lt;/p&gt;

&lt;p&gt;Let’s start by creating an API connection on KOR Connect by clicking on the “+ Connect API” button:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwg07xvqtu7udjuggvhem.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwg07xvqtu7udjuggvhem.jpeg" alt="Connect API Button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The connection details were all copied directly from RapidAPI. More information regarding the API connection module &lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/GETSTARTED.html" rel="noopener noreferrer"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3a9i91j6vjvzah2pizmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3a9i91j6vjvzah2pizmw.png" alt="Connection module"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Done! After making the connection, go to View Details for your new API connection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu1exv7dogze4zk0aikoa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu1exv7dogze4zk0aikoa.png" alt="Snippets"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you want, &lt;a href="https://www.youtube.com/watch?v=m-MAIpnH9ag" rel="noopener noreferrer"&gt;here&lt;/a&gt; is a great video tutorial by Traversy Media walking you through building the site on Vue.js. (&lt;a href="https://github.com/bradtraversy/vue-covid-tracker" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is the code for his COVID-19 tracker).&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; In the tutorial he uses a public API, we will use KOR Connect to easily integrate the private API into our site.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, all you need to do is grab the Secure URL and Public API Key provided by KOR Connect and use them to make an API request. Here's an example of the fetch request.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;YOUR-SECURE-URL&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;method&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;headers&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;x-rapidapi-key&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;YOUR-PUBLIC-API-KEY&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It was as simple as that, now your API integration works without any additional libraries or configurations.&lt;/p&gt;

&lt;p&gt;If you're interested in adding even more security through an attestation service keep reading. &lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Security
&lt;/h2&gt;

&lt;p&gt;Let’s take a look at how KOR Connect provides an additional layer of security. Follow along if you would like to implement Recaptcha as an attestation layer amongst other security features. &lt;/p&gt;

&lt;p&gt;You will have to navigate to the Additional Security section within the View Details of your API connection. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuv1f18b9lxqghpojsz0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuv1f18b9lxqghpojsz0y.png" alt="Additional_Security"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then you will have to turn on Additional Security. When Additional Security is turned on, the Security Type should read Single URL + Additional Security.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpvfm1010ubogsweoh1f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxpvfm1010ubogsweoh1f.png" alt="Toggle_additional_sec"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, scroll down to the snippets section and depending on what framework you are using for your project, you will add the corresponding snippets of code to your project. We will be walking though this Covid19 tracker API integration using VueJS. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvteor39uzngqc1tluir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvteor39uzngqc1tluir.png" alt="Vue_snippet"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Take a look at the following snippet:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftg2w3d0a3wf55lhxpgh0.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftg2w3d0a3wf55lhxpgh0.jpeg" alt="Snippet box"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how to integrated the snippet into your project:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8evdz2qu9yhqr01pzzb5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8evdz2qu9yhqr01pzzb5.png" alt="Modified snippet"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; the KOR Connect URL is modified with the paths I received from RapidAPI. For example, to get the total Covid cases I need to add this to my base URL:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faz6j8mssouab1cihrjmx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faz6j8mssouab1cihrjmx.png" alt="Path"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;All the paths available in the API you are using can be appended to the KOR Connect base URL (secure URL).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, all of the API calls are made to the public URL that KOR Connect provides. KOR Connect will act as a proxy to authenticate as well as send the API information. Furthermore, thanks to reCaptcha V3 (which is implemented automatically) and additional layers of security, several malicious attack vectors are blocked which enhances KOR Connects security.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzj4ttldiae61fbmtniyb.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzj4ttldiae61fbmtniyb.jpeg" alt="Finished site"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;With permission, this blog references this &lt;a href="https://dev.to/korconnect/secure-api-keys-on-the-frontend-vue-js-1l21"&gt;Covid 19 tracker blog&lt;/a&gt; post made by Rodrigo.&lt;/em&gt;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here are a few for more cool project tutorials using &lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;KOR Connect&lt;/a&gt;:&lt;/strong&gt;  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/korconnect/integrating-youtube-s-api-on-angular-to-download-music-without-a-backend-3bof"&gt;Connecting the YouTube API to download music without a backend on Angular&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/korconnect/connecting-a-gif-api-on-reactjs-without-a-backend-3fj7"&gt;Setting up a Gif generator API with on Reactjs&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/korconnect/integrate-apis-with-your-html-site-without-a-backend-2303"&gt;Integrating a real time currency exchange rate calculator API - HTML&lt;/a&gt; &lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>security</category>
      <category>vue</category>
    </item>
    <item>
      <title>Integrate APIs with your HTML Site without a Backend.</title>
      <dc:creator>rodrigomohr</dc:creator>
      <pubDate>Fri, 17 Sep 2021 21:40:25 +0000</pubDate>
      <link>https://dev.to/korconnect/integrate-apis-with-your-html-site-without-a-backend-2303</link>
      <guid>https://dev.to/korconnect/integrate-apis-with-your-html-site-without-a-backend-2303</guid>
      <description>&lt;h3&gt;
  
  
  Enrich your websites/apps with APIs; integrate them securely with only a couple of clicks.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F10944%2F1%2AVapNniGKyf_2yoKTnAwYRg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F10944%2F1%2AVapNniGKyf_2yoKTnAwYRg.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have you ever wanted to connect API resources to your frontend but do not want to go through the hassle of programming a backend?&lt;/p&gt;

&lt;p&gt;If you are a developer with an innovative idea that you want to implement quickly and securely but do not need/want to build a server-based backend; you can do that now in just minutes with KOR Connect. In this article I will walk you through how.&lt;/p&gt;

&lt;p&gt;In this example we are going to create a website that calculates the exchange rate between two different currencies, and we will use the ‘Currency Exchange’ API from RapidAPI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2290%2F1%2A_BcWbAVpqFDYV5IfHN4K_Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2290%2F1%2A_BcWbAVpqFDYV5IfHN4K_Q.png" alt="Image 1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will need to acquire the following items:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The API key.&lt;/li&gt;
&lt;li&gt;The name of the header where the API key will be received. For example RapidAPI uses the ‘x-rapidapi-key’ to receive the API Key.&lt;/li&gt;
&lt;li&gt;The API URL.&lt;/li&gt;
&lt;li&gt;Your website’s domain to allow the calls.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After getting these necessary items, go to korconnect.io and create your free account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2428%2F1%2A9KK8EIr9qZ2KUY67l7R_UQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2428%2F1%2A9KK8EIr9qZ2KUY67l7R_UQ.png" alt="Image 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press the ‘+ CONNECT API’ button and fill in the required parameters such as the API Key, the Header Name, API URL, and the allowed host names from where the API will be called:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AxfvEG5j4MC3o6cWc_ZIeVA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AxfvEG5j4MC3o6cWc_ZIeVA.png" alt="Image 3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configure the 'Target API URL' as the domain name where your API is pointing to without any paths (for example: target.api.com). Your connection can be in 'Production Mode' or in 'Testing Mode' where you can test it from your own computer.&lt;/p&gt;

&lt;p&gt;You will see your new API connection created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2658%2F1%2AiYiVj_lVuSDM0qSqLVo0UA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2658%2F1%2AiYiVj_lVuSDM0qSqLVo0UA.png" alt="Image 4"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, click on ‘View Details’ to see all of the specifics of your connection. Here you will find the 'Secure Base URL' that you can use to make calls to your API. You will only need to add the header 'x-api-key' with the key provided below, and you will be ready to make requests securely.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftxhhxy9lnk0y002lgh1x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftxhhxy9lnk0y002lgh1x.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The 'Single URL' provides basic protection for your connection, but if you want enhanced security for your API connection, you can implement it by clicking in the button 'Additional Security', and then switching the button that says 'Security Type: Single URL + Additional Security' in the upper right side of the screen. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5lq73opn4u30pr0raoy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq5lq73opn4u30pr0raoy.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This option strengthens the security of your connection by adding reCaptcha functionalities. In order for your Frontend to get the additional functionalities, you will need to copy the code provided in the ‘Code Snippets’ below. You can select a snippet for HTML, REACT, VUE and ANGULAR frameworks. For this example we will use the code for HTML.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2084%2F1%2A10jeg_L8T_lh9QqeLEnWpA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2084%2F1%2A10jeg_L8T_lh9QqeLEnWpA.png" alt="Image 5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will need to exchange the APIs url to the one that KOR provides and append the path as it were the endpoint of the third party API. Now add the required URL params to request the exchange, for example: “ExchangeRates/exchange?from_currency=Param1&amp;amp;to_currency=Param2&amp;amp;q=Param3”. In our case we will send the currencies ISO 4217 codes that we would like to convert.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2040%2F1%2Aqah9aqunbthxqGKe8E8BYw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2040%2F1%2Aqah9aqunbthxqGKe8E8BYw.png" alt="Image 6"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deploy your website, and that’s it! You no longer need to develop a backend to keep your API keys secure, just sign in to &lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;https://korconnect.io&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you need a more technical explanation, you can check &lt;a href="https://kor-comunity.gitlab.io/kor-connect/" rel="noopener noreferrer"&gt;https://kor-comunity.gitlab.io/kor-connect/&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>security</category>
      <category>serverless</category>
      <category>backend</category>
      <category>api</category>
    </item>
    <item>
      <title>Secure API Keys on the Frontend - Vue JS
</title>
      <dc:creator>Rodrigo</dc:creator>
      <pubDate>Fri, 17 Sep 2021 04:08:27 +0000</pubDate>
      <link>https://dev.to/korconnect/secure-api-keys-on-the-frontend-vue-js-1l21</link>
      <guid>https://dev.to/korconnect/secure-api-keys-on-the-frontend-vue-js-1l21</guid>
      <description>&lt;p&gt;Why are we going to use KOR Connect?&lt;/p&gt;

&lt;p&gt;APIs keys / secrets have been traditionally stored in an application’s backend but this requires control of your own server as well as specialized infrastructure knowledge to set up properly. On CDN hosted, or serverless client side applications it is often not possible to gain access to the server that is hosting the project. If the developer hardcodes the API keys to their frontend anyone is able to access the keys and steal them. When API keys are stolen the malicious agent is able to do whatever they want with the APIs. This could rack up costs for the developer, use all of the allowed calls, or if the APIs are used against the TOS the dev’s credentials may be revoked. The other route that is often suggested to hide API keys for client side applications is to set up serverless functions to store the API keys and act as a proxy for the frontend. The developer could also use CORS to identify the header origin to make sure that only the allowed domains are calling the proxy (so that not anyone is able to call the proxy url from anywhere). This may seem secure but CORS only verifies browser calls and can be easily spoofed or can be called from outside of the browser. A malicious agent could easily run up costs with a bot or have the endpoint shut down as well. KOR Connect has a system that automatically protects against these vulnerabilities as well as allows the developer to integrate any API in the simplest and quickest possible way. &lt;/p&gt;

&lt;p&gt;Now let me walk you through an example!&lt;/p&gt;

&lt;p&gt;I have wanted to create a COVID-19 tracker for sometime; I wanted to create the app in a way where I consume an API but without a backend. In order to do this, I had a couple of options.The approach that initially came to mind was to use public APIs on a static site, but during my planning phase I came across &lt;a href="https://rapidapi.com" rel="noopener noreferrer"&gt;https://rapidapi.com&lt;/a&gt;. Here I found an array of different options for Covid data APIs, the caveat was that the APIs required authentication.&lt;/p&gt;

&lt;p&gt;I could have spun up a small backend and dealt with authentication there but a simple COVID-19 tracker webapp didn’t warrant such efforts.&lt;/p&gt;

&lt;p&gt;In the end I ended up using &lt;a href="https://korconnect.io/" rel="noopener noreferrer"&gt;https://korconnect.io/&lt;/a&gt;, a connection middleware that allows you to connect APIs without a backend. This is how I did it:&lt;/p&gt;

&lt;p&gt;I created an account on &lt;a href="https://korconnect.io/" rel="noopener noreferrer"&gt;https://korconnect.io/&lt;/a&gt;&lt;br&gt;
Also created an account on &lt;a href="https://rapidapi.com/" rel="noopener noreferrer"&gt;https://rapidapi.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, I needed to choose an API to consume. I decided on this one which uses Johns Hopkins public data:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffz2fmsarb10bb8a3zvpz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffz2fmsarb10bb8a3zvpz.png" alt="https://rapidapi.com/axisbits-axisbits-default/api/covid-19-statistics/"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I started by creating an API connection on KOR Connect by clicking on the “+ Connect API” button:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foks4n7ozo0b0bf3yihle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foks4n7ozo0b0bf3yihle.png" alt="Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I added the connection details, all of this information was copied directly from RapidAPI. More information about that here: &lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/GETSTARTED.html" rel="noopener noreferrer"&gt;https://kor-comunity.gitlab.io/kor-connect/adir/GETSTARTED.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhuwytwk08zgfo7agplz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhuwytwk08zgfo7agplz.png" alt="Connection Details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Done! After making the connection I went to the code snippets to see how I would consume the API in my frontend. In my case I wanted to use VueJS to create my tracker so I went to the VueJS snippets section and retrieved the information I needed for the framework.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd7xkwmpzt5cgl8jwwbfv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd7xkwmpzt5cgl8jwwbfv.png" alt="VueJS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok, all good! Now, the tricky part…making the site. I don’t have much experience coding on React or Vue but I found a great video tutorial that walked me through building a COVID-19 tracker.&lt;/p&gt;

&lt;p&gt;Check this excellent tutorial by Traversy Media: &lt;a href="https://www.youtube.com/watch?v=m-MAIpnH9ag" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=m-MAIpnH9ag&lt;/a&gt; (Here is the code for his COVID-19 tracker &lt;a href="https://github.com/bradtraversy/vue-c.." rel="noopener noreferrer"&gt;https://github.com/bradtraversy/vue-c..&lt;/a&gt;.).&lt;/p&gt;

&lt;p&gt;One thing of note, in that tutorial he uses a public API. So I had to figure out how to use the Kor Connect snippet in my code. Thankfully, it was very easy!&lt;/p&gt;

&lt;p&gt;First, let’s take a look at how Kor Connect provides the snippet:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvs4w5di5xj14wb2eyf6l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvs4w5di5xj14wb2eyf6l.png" alt="Kor Connect Snippet"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how I integrated it into my project:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiwowxpojt5ulbsdnbrit.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiwowxpojt5ulbsdnbrit.png" alt="Code Implementation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Something to note is how I modified the KOR Connect URL with the paths I received from RapidAPI. For example, to get the summary report I needed to add this to the end of my URL:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/reports/total
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Pay attention to the paths that your API provider gives you and put them at the end of your KOR Connect URL.&lt;/p&gt;

&lt;p&gt;Now, all the calls can be made to the link that KOR Connect provides, KOR Connect will act as a proxy to authenticate as well as send back the API information. Furthermore, thanks to reCaptcha enterprise’s (which is implemented automatically) layers of security several malicious attack vectors are blocked, this enhances KOR Connects security.&lt;/p&gt;

&lt;p&gt;What does the final project look like?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff2cphqumvaob6kbk30ge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff2cphqumvaob6kbk30ge.png" alt="Result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Best of all, for this quick and safe API consumption I don’t need to expose my API token to the public nor do I have to spin up a backend.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>security</category>
      <category>webdev</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Connecting a gif API on ReactJS without a backend</title>
      <dc:creator>Clemenshemmerling</dc:creator>
      <pubDate>Fri, 17 Sep 2021 02:14:42 +0000</pubDate>
      <link>https://dev.to/korconnect/connecting-a-gif-api-on-reactjs-without-a-backend-3fj7</link>
      <guid>https://dev.to/korconnect/connecting-a-gif-api-on-reactjs-without-a-backend-3fj7</guid>
      <description>&lt;h2&gt;
  
  
  The simplest way to connect an API to a frontend with best practices applied automatically.
&lt;/h2&gt;

&lt;p&gt;We will create a gif search engine using KOR Connect.&lt;/p&gt;

&lt;p&gt;Prior to starting you will need to connect your API to KOR Connect, please do so following this documentation: &lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/GETSTARTED.html" rel="noopener noreferrer"&gt;https://kor-comunity.gitlab.io/kor-connect/adir/GETSTARTED.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you would like, you can test your connection with Postman or another API testing tool.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faefff9tfinjyadmnjey0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faefff9tfinjyadmnjey0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After making the API connection above, create a React project using this command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app giphy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the React project is created go to &lt;a href="http://korconnect.io" rel="noopener noreferrer"&gt;korconnect.io&lt;/a&gt; and click on “View Details.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwteqtits70yaoc1kle1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwteqtits70yaoc1kle1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inside View Details select the “Snippets” tab and then choose React. Install the dependencies shown in the snippet. &lt;em&gt;Dependencies must be installed inside the project folder&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install — save react-google-recaptcha-v3 axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installing the necessary dependencies import the libraries in the snippet, also replace the provider with the one shown by the snippet.&lt;/p&gt;

&lt;p&gt;The index.js should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';  
import ReactDOM from 'react-dom';  
import './index.css';  
import App from './App';  
import reportWebVitals from './reportWebVitals';  
import {  
  GoogleReCaptchaProvider,  
} from 'react-google-recaptcha-v3';ReactDOM.render(  
  &amp;lt;GoogleReCaptchaProvider reCaptchaKey="yourSnippetKey"&amp;gt;  
    &amp;lt;App /&amp;gt;  
  &amp;lt;/GoogleReCaptchaProvider&amp;gt;,  
  document.getElementById('root')  
);  
// If you want to start measuring performance in your app, pass a function  
// to log results (for example: reportWebVitals(console.log))  
// or send to an analytics endpoint. Learn more: [https://bit.ly/CRA-vitals](https://bit.ly/CRA-vitals)  
reportWebVitals();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now go to the App.js file and replace it with the snippet, it should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useEffect }  from 'react';  
import axios from 'axios';  
import {  
  useGoogleReCaptcha  
} from 'react-google-recaptcha-v3';const App = () =&amp;gt; {  
  const { executeRecaptcha } = useGoogleReCaptcha();// Create an event handler so you can call the verification on button click event or form submit  
  const handleGet = async () =&amp;gt; {  
    if (!executeRecaptcha) {  
      console.log('Execute recaptcha not yet available');  
    }const token = await executeRecaptcha('submit');  
    // Do whatever you want with the token  
    console.log(token);  
    axios.get('[https://yourSnippetURL/'](https://yourSnippetURL/'), { headers: { token, 'x-api-key': 'yourSnippetToken' } })  
    .then(response =&amp;gt; {  
      console.log(response)  
    })  
    .catch(error =&amp;gt; {  
      console.log(error)  
    })  
  };// You can use useEffect to trigger the verification as soon as the component being loaded  
  useEffect(() =&amp;gt; {  
    if (executeRecaptcha) {  
      handleGet();  
    }}, \[executeRecaptcha\]);useEffect(() =&amp;gt; {  
    const el = document.querySelector('.grecaptcha-badge');  
    el.style.display = 'none';  
  }, \[\]);return (  
    &amp;lt;&amp;gt;  
    &amp;lt;h1&amp;gt;Hello World&amp;lt;/h1&amp;gt;  
    &amp;lt;/&amp;gt;  
  );  
};export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now modify the code to adapt it to the application, to do this install a style library (we will use &lt;a href="https://material-ui.com/" rel="noopener noreferrer"&gt;https://material-ui.com/&lt;/a&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @material-ui/core
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In App.js import the following elements and useState.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useEffect, useState } from "react";  
import Grid from "[@material](http://twitter.com/material)\-ui/core/Grid";  
import TextField from "[@material](http://twitter.com/material)\-ui/core/TextField";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now add two constants to save the API data, the code should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const \[data, setData\] = useState(null);  
const { executeRecaptcha } = useGoogleReCaptcha();  
const \[headerInfo, setHeaderInfo\] = useState("");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create a function to allow users to search for any gif, add the necessary path in order to carry out this search feature. The code should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleSearch = async (event) =&amp;gt; {  
    const token = await executeRecaptcha("submit");  
    axios  
      .get(  
        \`[https://yourSnippetURL/v1/channels/search?q=${event.target.value}\`](https://yourSnippetURL/v1/channels/search?q=${event.target.value}`),  
        {  
          headers: {  
            token,  
            "x-api-key": "yourSnippetToken",  
          },  
        }  
      )  
      .then((response) =&amp;gt; {  
        setData(response.data.data);  
      })  
      .catch((error) =&amp;gt; {  
        console.log(error);  
      });  
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will modify the handleGet function to be able to store the response in a constant, the code should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const handleGet = async () =&amp;gt; {  
    if (!executeRecaptcha) {  
      console.log("Execute recaptcha not yet available");  
    }const token = await executeRecaptcha("submit");  
    // Do whatever you want with the token  
    console.log(token);  
    axios  
      .get("[https://](https://clemensk.korconnect.io/GIPHY/v1/gifs/random)[yourSnippetURL](https://yourSnippetURL/v1/channels/search?q=${event.target.value}`)[/v1/gifs/random](https://clemensk.korconnect.io/GIPHY/v1/gifs/random)", {  
        headers: {  
          token,  
          "x-api-key": "yourSnippetKey",  
        },  
      })  
      .then((response) =&amp;gt; {  
        setHeaderInfo(response.data.data);  
      })  
      .catch((error) =&amp;gt; {  
        console.log(error);  
      });  
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we will add an input to do the searches and we will also add a map to display our result, the App.js should look like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useEffect, useState } from "react";  
import axios from "axios";  
import { useGoogleReCaptcha } from "react-google-recaptcha-v3";  
import Grid from "[@material](http://twitter.com/material)\-ui/core/Grid";  
import TextField from "[@material](http://twitter.com/material)\-ui/core/TextField";const App = () =&amp;gt; {  
  const \[data, setData\] = useState(null);  
  const { executeRecaptcha } = useGoogleReCaptcha();  
  const \[headerInfo, setHeaderInfo\] = useState("");const handleSearch = async (event) =&amp;gt; {  
    const token = await executeRecaptcha("submit");  
    axios  
      .get(  
        \`[https://clemensk.korconnect.io/GIPHY/v1/channels/search?q=${event.target.value}\`](https://clemensk.korconnect.io/GIPHY/v1/channels/search?q=${event.target.value}`),  
        {  
          headers: {  
            token,  
            "x-api-key": "2y91wVZrme9mN93HMeGBv5wH9JoxVm8m5Mv61BQN",  
          },  
        }  
      )  
      .then((response) =&amp;gt; {  
        setData(response.data.data);  
      })  
      .catch((error) =&amp;gt; {  
        console.log(error);  
      });  
  };// Create an event handler so you can call the verification on button click event or form submit  
  const handleGet = async () =&amp;gt; {  
    if (!executeRecaptcha) {  
      console.log("Execute recaptcha not yet available");  
    }const token = await executeRecaptcha("submit");  
    // Do whatever you want with the token  
    console.log(token);  
    axios  
      .get("[https://clemensk.korconnect.io/GIPHY/v1/gifs/random](https://clemensk.korconnect.io/GIPHY/v1/gifs/random)", {  
        headers: {  
          token,  
          "x-api-key": "2y91wVZrme9mN93HMeGBv5wH9JoxVm8m5Mv61BQN",  
        },  
      })  
      .then((response) =&amp;gt; {  
        setHeaderInfo(response.data.data);  
      })  
      .catch((error) =&amp;gt; {  
        console.log(error);  
      });  
  };// You can use useEffect to trigger the verification as soon as the component being loaded  
  useEffect(() =&amp;gt; {  
    if (executeRecaptcha) {  
      handleGet();  
    }  
  }, \[executeRecaptcha\]);return (  
    &amp;lt;&amp;gt;  
      &amp;lt;Grid xs={12}&amp;gt;  
        &amp;lt;h1 className="center-align"&amp;gt;Gif Explorer&amp;lt;/h1&amp;gt;  
      &amp;lt;/Grid&amp;gt;  
      &amp;lt;Grid  
        xs={12}  
        container  
        direction="row"  
        justifyContent="center"  
        alignItems="center"  
      &amp;gt;  
        &amp;lt;img src={headerInfo.image\_url} alt="logo" /&amp;gt;  
      &amp;lt;/Grid&amp;gt;  
      &amp;lt;Grid xs={12}&amp;gt;  
        &amp;lt;TextField  
          id="standard-basic"  
          label="Search"  
          fullWidth  
          onChange={(e) =&amp;gt; handleSearch(e)}  
        /&amp;gt;  
      &amp;lt;/Grid&amp;gt;  
      {data &amp;amp;&amp;amp; data.map(  
        (gif) =&amp;gt;  
          gif.banner\_image &amp;amp;&amp;amp; (  
            &amp;lt;Grid  
              xs={12}  
              md={3}  
              key={data.id}  
              container="row"  
              justifyContent="center"  
              alignItems="center"  
            &amp;gt;  
              &amp;lt;img src={gif.banner\_image} alt="image" /&amp;gt;  
            &amp;lt;/Grid&amp;gt;  
          )  
      )}  
    &amp;lt;/&amp;gt;  
  );  
};export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we are ready to deploy the project to production we have to change the Connection Mode from Test Mode to Production Mode, this will turn on additional security.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/TESTINGPRODUCTIONMODES.html" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is some additional information pertaining to Testing and Production Modes on KOR Connect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnt1mq4z69v4d2c90ytlp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnt1mq4z69v4d2c90ytlp.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The gif finding app should be ready! KOR Connect is taking care of all the actions required behind the scenes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxijavm3sxjp1mhs0nzsm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxijavm3sxjp1mhs0nzsm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>node</category>
      <category>aws</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Integrating YouTube’s API on Angular to download music without a backend.</title>
      <dc:creator>Clemenshemmerling</dc:creator>
      <pubDate>Fri, 17 Sep 2021 00:31:32 +0000</pubDate>
      <link>https://dev.to/korconnect/integrating-youtube-s-api-on-angular-to-download-music-without-a-backend-3bof</link>
      <guid>https://dev.to/korconnect/integrating-youtube-s-api-on-angular-to-download-music-without-a-backend-3bof</guid>
      <description>&lt;h2&gt;
  
  
  We will create a web app to download music from YouTube using KOR Connect.
&lt;/h2&gt;

&lt;p&gt;The first thing we will have to do is create a connection between KOR Connect and the YouTube API.&lt;/p&gt;

&lt;p&gt;The YouTube API can be found here &lt;a href="https://rapidapi.com/ytjar/api/youtube-mp36/-lex.europa.eu" rel="noopener noreferrer"&gt;https://rapidapi.com/ytjar/api/youtube-mp36/-lex.europa.eu&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a KOR Connect account here if you don’t already have one &lt;a href="https://korconnect.io" rel="noopener noreferrer"&gt;https://korconnect.io&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftb6fzpmgzb2nom7kvn46.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftb6fzpmgzb2nom7kvn46.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To create this connection we will follow the steps in this link:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/GETSTARTED.html" rel="noopener noreferrer"&gt;https://kor-comunity.gitlab.io/kor-connect/adir/GETSTARTED.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0sjxzulpdjzdyiyjg3p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0sjxzulpdjzdyiyjg3p.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you would like, you can test your connection with Postman or another API testing tool.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuuq67dr9ic15n6l6d2x2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuuq67dr9ic15n6l6d2x2.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we will create our project in Angular, for this, we will use the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng new youtube-to-mp3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will install a library to give styles to our app, for this we will use the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng add @angular/material
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is the link to the documentation of how we integrated the library in the project&lt;/p&gt;

&lt;p&gt;&lt;a href="https://material.angular.io/" rel="noopener noreferrer"&gt;https://material.angular.io/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, we will create our &lt;em&gt;home component&lt;/em&gt;, for this, we will use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng generate component home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once our Angular project is created we will go to KOR Connect and navigate into the YouTube API connection, then select “View Details.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F86z5gl58ubkiqql0rsn7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F86z5gl58ubkiqql0rsn7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click the “Snippets” tab and select the angular snippet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dj4by2v53vwqi88nwe7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6dj4by2v53vwqi88nwe7.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbezqgjwx57buetvzp354.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbezqgjwx57buetvzp354.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inside this snippet, it will ask us to install some libraries. After we install the libraries we will configure our project as indicated by the snippet.&lt;/p&gt;

&lt;p&gt;Once everything is configured we will now modify the code to adapt it to the functionality of our Angular app.&lt;/p&gt;

&lt;p&gt;The first thing we must do is change the name of the requestApi to createLink, we will add some variables to save the API response in the home.component.ts file, our code should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Component, OnInit } from '[@angular/core](http://twitter.com/angular/core)';  
import { ReCaptchaV3Service } from 'ngx-captcha';  
import { HttpClient } from '[@angular/common](http://twitter.com/angular/common)/http';[@Component](http://twitter.com/Component)({  
  selector: 'app-home',  
  templateUrl: './home.component.html',  
  styleUrls: \['./home.component.scss'\],  
})  
export class HomeComponent implements OnInit {  
  siteKey: string = 'yourSnippetSiteKey';  
  URL: string = '';  
  loader: boolean = false;  
  info: any = null;constructor(  
    private reCaptchaV3Service: ReCaptchaV3Service,  
    private http: HttpClient  
  ) {}ngOnInit(): void {}createLink() {  
    this.loader = true;  
    this.info = null;  
    this.reCaptchaV3Service.execute(this.siteKey, 'homepage', (token) =&amp;gt; {  
      const headers = {  
        token,  
        'x-api-key': 'yourSnippetXAPIKey',  
      };let code;if (this.URL.includes('youtube.com')) {  
        code = this.URL.replace('[https://www.youtube.com/watch?v='](https://www.youtube.com/watch?v='), '');  
      }if (this.URL.includes('youtu.be')) {  
        code = this.URL.replace('[https://youtu.be/'](https://youtu.be/'), '');  
      }this.http  
        .get(  
          \`[https://yourSnippetURL/dl?id=${code}\`](https://clemensk.korconnect.io/youtube-music/dl?id=${code}`),  
          { headers }  
        )  
        .subscribe((response) =&amp;gt; {  
          this.info = response;  
          this.loader = false;  
          this.URL = '';  
        });  
    });  
  }  
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will add our UI interface to app.component.html, the code should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;mat-card&amp;gt;  
  &amp;lt;form class="example-form"&amp;gt;  
    &amp;lt;mat-form-field class="example-full-width" appearance="fill"&amp;gt;  
      &amp;lt;mat-label&amp;gt;PASTE THE YOUTUBE LINK HERE&amp;lt;/mat-label&amp;gt;  
      &amp;lt;input matInput placeholder="URL" name="URL" \[(ngModel)\]="URL" /&amp;gt;  
    &amp;lt;/mat-form-field&amp;gt;  
  &amp;lt;/form&amp;gt;  
  &amp;lt;div class="example-button-container"&amp;gt;  
    &amp;lt;button mat-fab color="primary" (click)="createLink()"&amp;gt;  
      &amp;lt;mat-icon&amp;gt;library\_music&amp;lt;/mat-icon&amp;gt;  
    &amp;lt;/button&amp;gt;  
  &amp;lt;/div&amp;gt;  
&amp;lt;/mat-card&amp;gt;  
&amp;lt;div class="container"&amp;gt;  
  &amp;lt;div class="middle" \*ngIf="loader"&amp;gt;  
    &amp;lt;div class="bar bar1"&amp;gt;&amp;lt;/div&amp;gt;  
    &amp;lt;div class="bar bar2"&amp;gt;&amp;lt;/div&amp;gt;  
    &amp;lt;div class="bar bar3"&amp;gt;&amp;lt;/div&amp;gt;  
    &amp;lt;div class="bar bar4"&amp;gt;&amp;lt;/div&amp;gt;  
    &amp;lt;div class="bar bar5"&amp;gt;&amp;lt;/div&amp;gt;  
    &amp;lt;div class="bar bar6"&amp;gt;&amp;lt;/div&amp;gt;  
    &amp;lt;div class="bar bar7"&amp;gt;&amp;lt;/div&amp;gt;  
    &amp;lt;div class="bar bar8"&amp;gt;&amp;lt;/div&amp;gt;  
  &amp;lt;/div&amp;gt;  
  &amp;lt;div class="info" \*ngIf="info"&amp;gt;  
    &amp;lt;h4&amp;gt;{{info.title}}&amp;lt;/h4&amp;gt;  
    &amp;lt;a mat-raised-button href="{{info.link}}" color="warn"&amp;gt;  
      Download  
      &amp;lt;mat-icon&amp;gt;file\_download&amp;lt;/mat-icon&amp;gt;  
    &amp;lt;/a&amp;gt;  
  &amp;lt;/div&amp;gt;  
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we will add the necessary styles inside the home.component.scss file, the code should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mat-form-field {  
  width: 100%;  
}.info.ng-star-inserted {  
    margin: 25% 0;  
    text-align: center;  
}body {  
  margin: 0;  
  padding: 0;  
  box-sizing: border-box;  
  background: #000;  
}.middle {  
  top: 50%;  
  left: 50%;  
  transform: translate(-50%, -50%);  
  position: absolute;  
}.bar {  
  width: 10px;  
  height: 70px;  
  background: #fff;  
  display: inline-block;  
  transform-origin: bottom center;  
  border-top-right-radius: 20px;  
  border-top-left-radius: 20px;  
  /\*   box-shadow:5px 10px 20px inset rgba(255,23,25.2); \*/  
  animation: loader 1.2s linear infinite;  
}.bar1 {  
  animation-delay: 0.1s;  
}.bar2 {  
  animation-delay: 0.2s;  
}.bar3 {  
  animation-delay: 0.3s;  
}.bar4 {  
  animation-delay: 0.4s;  
}.bar5 {  
  animation-delay: 0.5s;  
}.bar6 {  
  animation-delay: 0.6s;  
}.bar7 {  
  animation-delay: 0.7s;  
}.bar8 {  
  animation-delay: 0.8s;  
}[@keyframes](http://twitter.com/keyframes) loader {  
  0% {  
    transform: scaleY(0.1);  
  }50% {  
    transform: scaleY(1);  
    background: yellowgreen;  
  }100% {  
    transform: scaleY(0.1);  
    background: transparent;  
  }  
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we are ready to deploy the project to production we have to change the Connection Mode from Test Mode to Production Mode, this will turn on additional security.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kor-comunity.gitlab.io/kor-connect/adir/TESTINGPRODUCTIONMODES.html" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is some additional information pertaining to Testing and Production Modes on KOR Connect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6erjn1e9idfzd0kqym3k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6erjn1e9idfzd0kqym3k.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have our app to download music from YouTube using KOR Connect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtube-to-mp3.kor-test.com/" rel="noopener noreferrer"&gt;https://youtube-to-mp3.kor-test.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fisf894123toj1r88cle0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fisf894123toj1r88cle0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>node</category>
      <category>serverless</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
