<?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: Clemenshemmerling</title>
    <description>The latest articles on DEV Community by Clemenshemmerling (@clemenshemmerling).</description>
    <link>https://dev.to/clemenshemmerling</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%2Fuser%2Fprofile_image%2F706713%2Fb66471f8-7b17-4918-ab01-b2c173a061ac.jpg</url>
      <title>DEV Community: Clemenshemmerling</title>
      <link>https://dev.to/clemenshemmerling</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/clemenshemmerling"/>
    <language>en</language>
    <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>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>
