<?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: Lere🦄💜</title>
    <description>The latest articles on DEV Community by Lere🦄💜 (@temitopeasama).</description>
    <link>https://dev.to/temitopeasama</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%2F624994%2F7e12c7de-e8ec-496f-92c4-15dce0ccf215.png</url>
      <title>DEV Community: Lere🦄💜</title>
      <link>https://dev.to/temitopeasama</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/temitopeasama"/>
    <language>en</language>
    <item>
      <title>An Introduction to Algorithms in Computer Science</title>
      <dc:creator>Lere🦄💜</dc:creator>
      <pubDate>Thu, 18 Nov 2021 11:22:13 +0000</pubDate>
      <link>https://dev.to/temitopeasama/an-introduction-to-algorithms-in-computer-science-4nng</link>
      <guid>https://dev.to/temitopeasama/an-introduction-to-algorithms-in-computer-science-4nng</guid>
      <description>&lt;h2&gt;
  
  
  Table of Content
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt; What are Algorithms and why are they so important?
&lt;/li&gt;
&lt;li&gt;  Picking the right algorithm: What makes a good algorithm? &lt;/li&gt;
&lt;li&gt; Correctness vs Efficiency &lt;/li&gt;
&lt;li&gt;  How to measure the efficiency of an algorithm? &lt;/li&gt;
&lt;li&gt; Conclusion &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are Algorithms and why are they so important?
&lt;/h2&gt;

&lt;p&gt;An algorithm is a specific procedure for solving a well-defined computational problem. In simpler terms, we can say that an algorithm is a set of step-by-step instructions or finite processes which if followed, solve a specific problem. Algorithms are useful in analyzing huge data sets or selecting intelligently from a vast number of possible options. They allow massive computational power to be harnessed into meeting people’s needs and solving problems.&lt;/p&gt;

&lt;p&gt;Let’s talk about a few applications of algorithms;&lt;/p&gt;

&lt;p&gt;Say, for example, you wanted to buy groceries at the nearest grocery store, two streets away from your house. You could write an algorithm to perform this task as thus;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write a grocery list.&lt;/li&gt;
&lt;li&gt;Leave the house.&lt;/li&gt;
&lt;li&gt;Drive to the store.&lt;/li&gt;
&lt;li&gt;Pick up a grocery basket.&lt;/li&gt;
&lt;li&gt;Go to the aisle where every item you have on your list is and put them in the basket.&lt;/li&gt;
&lt;li&gt;Go to the checkout point to pay for your items.&lt;/li&gt;
&lt;li&gt;Drive back home.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What about an algorithm for making tea?&lt;/p&gt;

&lt;p&gt;In this order, you’d want to;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Boil water. If using an electric kettle with temperature setting, set it to about 208°F for black tea. &lt;/li&gt;
&lt;li&gt;Warm-up teapot.&lt;/li&gt;
&lt;li&gt;Put the tea into a teapot and add hot water.&lt;/li&gt;
&lt;li&gt;Cover teapot and steep tea for 5 minutes.&lt;/li&gt;
&lt;li&gt;Strain tea solids and pour hot tea into teacups.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There, you have it!&lt;/p&gt;

&lt;p&gt;You have successfully written out a set of step-by-step instructions to carry out two different tasks.  &lt;/p&gt;

&lt;p&gt;Let’s take a few practical examples. &lt;/p&gt;

&lt;p&gt;Have you ever wondered how Zoom transmits live videos between people in different parts of the world? If you guessed audio and video compression algorithms, then you’re correct!&lt;/p&gt;

&lt;p&gt;Google Maps uses route-finding algorithms to help you locate the shortest route to places you want to go. Twitter curates your feed by monitoring your engagement through optimization algorithms. These and so on are practical applications of algorithms in building scalable and reliable software and services that make our everyday lives, quite interesting.&lt;/p&gt;

&lt;p&gt;While of course, algorithms in Computer Science are more complex than our day-to-day applications of algorithms like grocery shopping or starting up your car, they all boil down to the same process of following steps of instructions to solve problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Picking the right algorithm: What makes a good algorithm?
&lt;/h2&gt;

&lt;p&gt;So how do you know what algorithm to pick?&lt;/p&gt;

&lt;p&gt;if you’ll be picking an existing algorithm or writing a new one, it is important to apply one that saves you time and effort. It is quite helpful to know how to design algorithms and to analyze them for correctness and efficiency.&lt;/p&gt;

&lt;p&gt;Now, not all algorithms are made equal. Two things qualify a good algorithm;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Correctness&lt;/strong&gt; - If you’re going to be writing an algorithm to carry out a specific task. You want to be sure it can carry out that task error-free. A good algorithm carries out the task at hand, accurately.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficiency&lt;/strong&gt; - Asides from carrying out the task correctly, you’d also want an algorithm that would do so efficiently as well, saving us space and most importantly, time. A good algorithm not only performs a task correctly but efficiently too.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Correctness vs Efficiency
&lt;/h2&gt;

&lt;p&gt;Most of the time, you want to pick an algorithm based on its ability to solve problems correctly or produce correct answers only. Other times, you could live with an algorithm that doesn’t give you the best answer because the one that does, takes a really long time to run. &lt;/p&gt;

&lt;p&gt;Take for example;&lt;/p&gt;

&lt;p&gt;Say we want to write a program to find the most efficient route to your favorite cloth store, after delivering milk to 30 different locations. It would take days or even weeks to run! But you could settle for an algorithm that finds a good route, maybe not the best, and it would run in seconds.&lt;/p&gt;

&lt;p&gt;Let’s re-examine our grocery shopping example again;&lt;/p&gt;

&lt;p&gt;While of course, the previous algorithm helps you perform your grocery shopping task quite correctly, it could be better. You could go with the online shopping option. Then our algorithm will look like this;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the store’s website.&lt;/li&gt;
&lt;li&gt;Find the item you want using their search option.&lt;/li&gt;
&lt;li&gt;Add all the items on your list to your cart. &lt;/li&gt;
&lt;li&gt;Proceed to checkout to pay for your goods.&lt;/li&gt;
&lt;li&gt;Get your goods delivered to your doorstep.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this case, you get to perform the same task without leaving your bed, saving you both time and energy which could have been spent driving back and forth and walking around the supermarket, searching manually for the items on your list.&lt;/p&gt;

&lt;p&gt;So it is in Computer Science, we constantly seek ways to perform a task in the least time, consuming the lowest storage possible. Sometimes, complete accuracy is a must so we have to use a certain algorithm no matter how long it takes to run. Other times, good is good enough and saves us a lot of time and unnecessary stress.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to measure the efficiency of an algorithm?
&lt;/h2&gt;

&lt;p&gt;You could time how long it takes an algorithm to run but that would only tell us about that particular implementation in a certain programming language on a particular local machine. That is to say;&lt;/p&gt;

&lt;p&gt;The actual running time depends on factors like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The speed of the computer.&lt;/li&gt;
&lt;li&gt;The compiler and compiler options.&lt;/li&gt;
&lt;li&gt;The quantity of data.&lt;/li&gt;
&lt;li&gt;Programming language used (Lower-level languages like C++ run faster than Higher-level languages like Java).&lt;/li&gt;
&lt;li&gt;Available memory size.&lt;/li&gt;
&lt;li&gt;Algorithm time complexity (we’ll get to this later in this series).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hence the measure of the amount of time for an algorithm to execute, which is the Time Efficiency of the algorithm, due to the variable factors on which it is dependent, is not enough metric to conclude the overall efficiency of an algorithm.&lt;/p&gt;

&lt;p&gt;What about space?&lt;/p&gt;

&lt;p&gt;Earlier in this article, we learned that efficiency is measured in relation to time and space. We could also measure the Space Efficiency, which is a measure of how much memory an algorithm uses in its execution, but it still isn’t the most reliable way to measure the overall efficiency of the algorithm.&lt;/p&gt;

&lt;p&gt;How then do we measure the efficiency of an algorithm?&lt;/p&gt;

&lt;p&gt;One technique scientists employ is called &lt;strong&gt;Asymptotic Analysis&lt;/strong&gt;. This technique allows algorithms to be compared independently of programming language or hardware so that we can conclude correctly what algorithms are more efficient than the others.&lt;/p&gt;

&lt;p&gt;In the next article, we’ll be looking at Asymptotic Analysis and how it can help us analyze and choose the right algorithm for a specific task.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we discussed the basics of algorithms and how they work, the two criteria for picking an algorithm, and the dilemma of picking one criterion over the other. In the next article, we’ll be discussing Asymptotic Analysis and how this technique helps us determine the efficiency of an algorithm and its suitability for the task at hand.&lt;/p&gt;

&lt;p&gt;See you there!🎉🎉&lt;/p&gt;

</description>
      <category>programming</category>
      <category>computerscience</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Creating a personal image gallery with VueJS, Auth0 and Cloudinary.</title>
      <dc:creator>Lere🦄💜</dc:creator>
      <pubDate>Sun, 17 Oct 2021 03:08:43 +0000</pubDate>
      <link>https://dev.to/hackmamba/creating-a-personal-image-gallery-with-vuejs-auth0-and-cloudinary-56pf</link>
      <guid>https://dev.to/hackmamba/creating-a-personal-image-gallery-with-vuejs-auth0-and-cloudinary-56pf</guid>
      <description>&lt;p&gt;In this article, you will be learning how to create a personal image gallery using VueJS, Auth0 and Cloudinary API. With this application, users will be able to sign in using the authorization and authentication features of Auth0, create a profile and upload and download images with the help of Cloudinary.&lt;/p&gt;

&lt;p&gt;You might be looking for the complete code. I've created a &lt;a href="https://github.com/TemitopeAsama/Hackmamba-Repository/tree/master/ackmamba_jamstack_hackathon_video_collection--master" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt; where you can find the complete code for the app.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up Auth0
&lt;/h3&gt;

&lt;p&gt;Auth0 is a flexible, drop-in solution to add authentication and authorization services to your applications. You are able to avoid the cost, time, and risk that come with building your own solution to authenticate and authorize users.&lt;/p&gt;

&lt;p&gt;To set up Auth0, the first thing you will be needing is an Application in Auth0, so head on over to their website and &lt;a href="https://auth0.com/" rel="noopener noreferrer"&gt;create an account&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After setting up your account, the next thing you want to do is create your first application. You can do that by clicking the applications item on the menu on the left side and click “Create Application”.&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%2Fjgqq0qsk9ss4bm4us5d9.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%2Fjgqq0qsk9ss4bm4us5d9.png" alt="Image1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the image above, we see what that dropdown looks like;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The first arrow points to the name box; here you can enter the name for your app and in this example, we’ll be calling it &lt;strong&gt;“My App”&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;The second arrow points to the application type options available, and for this project we’ll be using the &lt;strong&gt;“Single Page Web Applications”&lt;/strong&gt; option, because just like the description says, we’ll be building a JavaScript front-end app that uses an API. &lt;/li&gt;
&lt;li&gt;When that’s done, click &lt;strong&gt;“Create”&lt;/strong&gt;. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This sets up the application with default configuration for a Single Page Web Application. This configuration can be tweaked or changed later if you need or want to.&lt;/p&gt;

&lt;p&gt;In the settings, add &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; to the Allowed Callback URLs, Allowed Logout URLs, Allowed Web Origins and Allowed Origins (CORS) fields. This is due to the fact that the sample client will be running on &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; you'll need to add the appropriate values if you're running on a server or a different port or on a host that isn't localhost&lt;/p&gt;

&lt;p&gt;The rest of the defaults can be left as is.&lt;/p&gt;

&lt;p&gt;From the image above, we see what that dropdown looks like;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The first arrow points to the name box; here you can enter the name for your app and in this example, we’ll be calling it “My App”. &lt;/li&gt;
&lt;li&gt;The second arrow points to the application type options available, and for this project we’ll be using the “Single Page Web Applications” option, because just like the description says, we’ll be building a JavaScript front-end app that uses an API. &lt;/li&gt;
&lt;li&gt;When that’s done, click “Create”. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This sets up the application with default configuration for a Single Page Web Application. This configuration can be tweaked or changed later if you need or want to.&lt;/p&gt;

&lt;p&gt;In the settings, add &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; to the Allowed Callback URLs, Allowed Logout URLs, Allowed Web Origins and Allowed Origins (CORS) fields. This is due to the fact that the sample client will be running on &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; you'll need to add the appropriate values if you're running on a server or a different port or on a host that isn't localhost&lt;/p&gt;

&lt;p&gt;The rest of the defaults can be left as is.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up Cloudinary
&lt;/h3&gt;

&lt;p&gt;Cloudinary is a media management platform for web and mobile developers. Cloudinary is an end-to-end image- and video-management solution for websites and mobile apps, covering everything from image and video uploads, storage, manipulations, optimizations to delivery.&lt;/p&gt;

&lt;p&gt;First, just like we did with Auth0, we have to &lt;a href="https://cloudinary.com/" rel="noopener noreferrer"&gt;create an account on Cloudinary&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%2Fylkbvjxnahlhi6h7308v.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%2Fylkbvjxnahlhi6h7308v.png" alt="Image2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When creating an account on Cloudinary, it’s important to choose the option that best describes your use for it. Here, we’ll be making use of their API to manipulate media on our project, so it’s only appropriate that we select the option “Programmable Media for image and video API”. When that’s over and done, you can then proceed to creating your 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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7yizge1vuy0k3r8jahwr.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%2F7yizge1vuy0k3r8jahwr.png" alt="Image11"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When your account is created and fully functional, you should see your dashboard, just like the one above.&lt;/p&gt;

&lt;p&gt;Log into your Cloudinary account and set up an upload preset that will be handling the images being uploaded. Before setting up an upload preset, you’ll first have to create a media library folder that will hold the images being uploaded. You can do this using the following steps;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the media library.&lt;/li&gt;
&lt;/ol&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%2Fzrd7ym522xk703yfjpas.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%2Fzrd7ym522xk703yfjpas.png" alt="Image3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new folder. we’ll be calling our folder “My images”.&lt;/li&gt;
&lt;/ol&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%2Fr7jjsuj3tgw2v7qglyb1.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%2Fr7jjsuj3tgw2v7qglyb1.png" alt="Image4"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, Cloudinary gives developers a tool that allows us integrate it in VueJS applications, called the VueJS SDK. The Cloudinary Vue.js SDK serves as a layer on top of Cloudinary's JavaScript (Cloudinary-core) library.&lt;/p&gt;

&lt;p&gt;We can install the SDK by running 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;npm install cloudinary-vue

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we can proceed with creating the upload preset.&lt;br&gt;
Go to the Settings option and click Upload (tab)&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%2F7klexvx7lmneh3ylk0zs.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%2F7klexvx7lmneh3ylk0zs.png" alt="Image5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scroll down to and click on add upload preset.&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%2Fxrqs0mnnnohww2goqp6p.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%2Fxrqs0mnnnohww2goqp6p.png" alt="Image6"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the Upload preset name, select the Unsigned signing mode and input the name of the folder that you created above. In this case, &lt;strong&gt;“my images”&lt;/strong&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%2F1v6dm01beucnq10qq4zt.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%2F1v6dm01beucnq10qq4zt.png" alt="Image7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Set the Upload preset name, select the Unsigned signing mode and input the name of the folder that you created above. In this case, “my images”&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%2Fpaper-attachments.dropbox.com%2Fs_CD896DC971CCB47C6D3C431710AC6C2AE63CC9D657F228DAF13FC2AF20E55F45_1633502628689_ab.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%2Fpaper-attachments.dropbox.com%2Fs_CD896DC971CCB47C6D3C431710AC6C2AE63CC9D657F228DAF13FC2AF20E55F45_1633502628689_ab.png" alt="img8"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It’s important to note that &lt;strong&gt;Unsigned upload presets are used when implementing upload capabilities from client-side apps i.e. allowing uploads straight from the browser&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Go to Upload control and switch the return delete token on if you’d like to be able to delete uploaded images.&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%2F6dzz50utgbr2cno317vs.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%2F6dzz50utgbr2cno317vs.png" alt="Image9"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: You can only use the delete token to delete an uploaded file within a span of ten minutes after uploading it.&lt;/p&gt;

&lt;p&gt;Set up the rest of the settings to your preferences and click on 'save' to save this new upload preset.&lt;br&gt;
Back on the settings page and upload tab the new upload preset will be listed amongst the existing presets.&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%2F8c10nfd3aot68xkdenlm.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%2F8c10nfd3aot68xkdenlm.png" alt="Image10"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: You can only use the delete token to delete an uploaded file within a span of ten minutes after uploading it.&lt;/p&gt;

&lt;p&gt;Set up the rest of the settings to your preferences and click on 'save' to save this new upload preset.&lt;br&gt;
Back on the settings page and upload tab the new upload preset will be listed amongst the existing presets.&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%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--YuIjlk3S--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_66%252Cw_880%2Fhttps%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft4cp1pbkhac8gxrwjefx.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%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--YuIjlk3S--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_66%252Cw_880%2Fhttps%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft4cp1pbkhac8gxrwjefx.gif" alt="Credit: James Sinkala"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  The Vue Component
&lt;/h3&gt;

&lt;p&gt;So to create the Vue Component that will allow users upload images to Cloudinary through the created upload preset.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Template
&lt;/h2&gt;

&lt;p&gt;The template below contains the file upload button that will trigger the uploader modal. We can put in a &lt;code&gt;Main.vue&lt;/code&gt; file.&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;template&amp;gt;
&amp;lt;div&amp;gt;
    &amp;lt;Header/&amp;gt;
  &amp;lt;v-card&amp;gt;
    &amp;lt;div class="helldo"&amp;gt;
      &amp;lt;input type="file" @change="onFileSelected"&amp;gt; 
      &amp;lt;v-btn v-if="displayUploadBtn" outlined @click="uploadFile"&amp;gt; Upload &amp;lt;/v-btn &amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;v-tabs
      color="deep-purple accent-4"
      right
    &amp;gt;
      &amp;lt;v-tab&amp;gt;Landscape&amp;lt;/v-tab&amp;gt;
      &amp;lt;v-tab&amp;gt;City&amp;lt;/v-tab&amp;gt;
      &amp;lt;v-tab&amp;gt;Abstract&amp;lt;/v-tab&amp;gt;
      &amp;lt;v-tab-item
        v-for="n in 3"
        :key="n"
      &amp;gt;
        &amp;lt;v-container fluid&amp;gt;
          &amp;lt;v-row&amp;gt;
            &amp;lt;v-col
              v-for="i in 6"
              :key="i"
              cols="12"
              md="4"
            &amp;gt;
              &amp;lt;v-img
                :src="`https://picsum.photos/500/300?image=${i * n * 5 + 10}`"
                :lazy-src="`https://picsum.photos/10/6?image=${i * n * 5 + 10}`"
                aspect-ratio="1"
              &amp;gt;&amp;lt;/v-img&amp;gt;
            &amp;lt;/v-col&amp;gt;
          &amp;lt;/v-row&amp;gt;
        &amp;lt;/v-container&amp;gt;
      &amp;lt;/v-tab-item&amp;gt;
    &amp;lt;/v-tabs&amp;gt;
  &amp;lt;/v-card&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;:src&lt;/strong&gt; attributes on line 35 and 36 serves to generate random images from &lt;a href="https://picsum.photos/500/300?image=" rel="noopener noreferrer"&gt;Picsum&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Axios
&lt;/h3&gt;

&lt;p&gt;To make promise-based HTTP requests, I’d be installing &lt;a href="https://www.npmjs.com/package/axios" rel="noopener noreferrer"&gt;Axios&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;#install axios
npm i axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installing Axios, I can then use it to make request to the Cloudinary API.&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;script&amp;gt;
import axios from "axios"
import Header from '../Header/Main.vue'

export default {
    name: "home",
    data: () =&amp;gt; ({
    displayUploadBtn: false,
    selectedFile: null,
    CLOUDINARY_URL: "https://api.cloudinary.com/v1_1/yungscript/upload",
    CLOUDINARY_PRESET: "hk7esqdc" //your Cloudinary preset
}),

components: {
  Header
  },
    methods: {
    onFileSelected(event) {
    this.selectedFile = event.target.files[0]
    this.displayUploadBtn = true
},

uploadFile() {

let file = this.selectedFile
let formData = new FormData()

console.log(file);

formData.append("file", file)
formData.append("upload_preset", this.CLOUDINARY_PRESET)

axios({
  url: this.CLOUDINARY_URL,
  method: "POST",
  headers: {
  "Content-Type": "application/x-www-form-urlencoded"
},
data: formData
})
.then((res) =&amp;gt; {
console.log(res);
})
.catch((err) =&amp;gt; {
console.log(err);
})
}
}
};
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the CLOUDINARY_URL is the URL that contains the images uploaded by the user.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integrating Auth0
&lt;/h3&gt;

&lt;p&gt;From the account you created above, you’d be given a domain name and a client ID. Your domain is the base URL that you will use to access the Auth0 APIs and the URL where you'll redirect users to log in, while the client ID is an alphanumeric string, and it's the unique identifier for your application.  You cannot modify the Client ID. You will use the Client ID to identify the Auth0 Application to which the Auth0 SPA SDK needs to connect.&lt;/p&gt;

&lt;p&gt;Now, you’ll create an &lt;strong&gt;auth_config.json&lt;/strong&gt; file and add both your client ID and Domain.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
{
    "domain": "YOUR_AUTH0_DOMAIN",
  "clientId": "YOUR_AUTH0_CLIENT_ID"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, Execute the following command to install the Auth0 SPA SDK:&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 @auth0/auth0-spa-js

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an auth directory within the src directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir src/auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an index.js file within the src/auth directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch src/auth/index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Populate index.js with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
/**
 *  External Modules
 */

import Vue from 'vue';
import createAuth0Client from '@auth0/auth0-spa-js';

/**
 *  Vue.js Instance Definition
 */

let instance;

export const getInstance = () =&amp;gt; instance;

/**
 *  Vue.js Instance Initialization
 */

export const useAuth0 = ({
  onRedirectCallback = () =&amp;gt;
    window.history.replaceState({}, document.title, window.location.pathname),
  redirectUri = window.location.origin,
  ...pluginOptions
}) =&amp;gt; {
  if (instance) return instance;

  instance = new Vue({
    data() {
      return {
        auth0Client: null,
        isLoading: true,
        isAuthenticated: false,
        user: {},
        error: null,
      };
    },
    methods: {

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now to handle the callback when logging in using a redirect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
/** Handles the callback when logging in using a redirect */
      async handleRedirectCallback() {
        this.isLoading = true;
        try {
          await this.auth0Client.handleRedirectCallback();
          this.user = await this.auth0Client.getUser();
          this.isAuthenticated = true;
        } catch (error) {
          this.error = error;
        } finally {
          this.isLoading = false;
        }
      },

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In cases where the user forget the password or token and might have to retrieve or renew it, we can then use the following to allow for token retrieval and redirect the user back to the login page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
/** Authenticates the user using the redirect method */
      loginWithRedirect(options) {
        return this.auth0Client.loginWithRedirect(options);
      },
/** Returns the access token. If the token is invalid or missing, a new one is retrieved */
      logout(options) {
        return this.auth0Client.logout(options);
      },
/** Returns the access token. If the token is invalid or missing, a new one is retrieved */
      getTokenSilently(o) {
        return this.auth0Client.getTokenSilently(o);
      },
    },

/** Use this lifecycle method to instantiate the SDK client */
    async created() {
      this.auth0Client = await createAuth0Client({
        ...pluginOptions,
        domain: pluginOptions.domain,
        client_id: pluginOptions.clientId,
        audience: pluginOptions.audience,
        redirect_uri: redirectUri,
      });

      try {
// If the user is returning to the app after authentication..
        if (
          window.location.search.includes('code=') &amp;amp;&amp;amp;
          window.location.search.includes('state=')
        ) {
          const { appState } = await this.auth0Client.handleRedirectCallback();

 // Notify subscribers that the redirect callback has happened, passing the appState
                    // (useful for retrieving any pre-authentication state)
          onRedirectCallback(appState);
        }
      } catch (error) {
        this.error = error;
      } finally {
 // Initialize our internal authentication state
        this.isAuthenticated = await this.auth0Client.isAuthenticated();
        this.user = await this.auth0Client.getUser();
        this.isLoading = false;
      }
    },
  });

  return instance;
};

/**
 *  Vue.js Plugin Definition
 */
// Create a simple Vue plugin to expose the wrapper object throughout the application
export const Auth0Plugin = {
  install(Vue, options) {
    Vue.prototype.$auth = useAuth0(options);
  },
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Routing
&lt;/h3&gt;

&lt;p&gt;The following block of code serves to tell the browser what page to load. From the four components created, I can import and reference them as below;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
// import Profile from "../components/Profile/Profile.vue";
const Home = () =&amp;gt; import(/* webpackChunkName: "about" */ '../components/Home/Main.vue') //imports the Home Component
const About = () =&amp;gt; import(/* webpackChunkName: "about" */ '../components/About/Main.vue') //imports the About Component
const Profile = () =&amp;gt; import(/* webpackChunkName: "about" */ '../components/Profile/Main.vue') //imports the Profile Component
const Media = () =&amp;gt; import(/* webpackChunkName: "about" */ '../components/Media/Main.vue') //imports the Media component
import { authGuard } from "../auth/authGuard";

Vue.use(VueRouter)
const routes = [
  {
    path: '/',
    name: 'Home',
    // redirect: "/home",
    component: Home
  },
  {
    path: '/about',
    name: 'About', //go to About Page
    component: About
  },
  {
    path: "/profile",
    name: "Profile", // go to Profile Page
    component: Profile,
    beforeEnter: authGuard //before user goes to profile page, it checks if user is logged in. If not, it redirects the user to the login page.
  },
  {
    path: "/media",
    name: "Media", // go to Profile Page
    component: Media
  }
]
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
export default router

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Plugins
&lt;/h3&gt;

&lt;p&gt;I added the Vuetify package to style the project but feel free to use what you like. Bootstrap works just fine as well. Install Vuetify in your Vue app after creating your Vue project using Vue CLI 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;vue add vuetify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Import Vue into your project as such:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import Vue from 'vue';
import Vuetify from 'vuetify/lib/framework';
Vue.use(Vuetify);
export default new Vuetify({
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Voila, you’ve successfully integrated Cloudinary and Auth0 into your VueJS project.&lt;/p&gt;

&lt;p&gt;Content created for the &lt;a href="https://content.hackmamba.io/" rel="noopener noreferrer"&gt;Hackmamba&lt;/a&gt; Jamstack Content Hackathon with &lt;a href="https://auth0.com/" rel="noopener noreferrer"&gt;Auth0&lt;/a&gt; and &lt;a href="https://cloudinary.com/" rel="noopener noreferrer"&gt;Cloudinary&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>cloudinary</category>
    </item>
  </channel>
</rss>
