Hide an API Key | JavaScript Tutorial

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • ‍🎓 NEW: Earn a professional certificate in web development from Meta Inc. (course links in card below) 👇
    ⚡ Need hosting for a website, WordPress blog or Node.js app? We use HostWithLove: bit.ly/3V2RM9Q ❤️
    This tutorial shows you how to hide an API key from users on the frontend and in your backend source code using environment variables.
    #javascript #javascript_tutorial #nodejs #api #webdevelopment #frontend #tutorial
    ⚡Web development professional certificates from Meta Inc.⚡
    Front-End Developer Professional Certificate: imp.i384100.ne...
    Back-End Developer Professional Certificate: imp.i384100.ne...
    iOS Developer Professional Certificate: imp.i384100.ne...
    Meta Android Developer Professional Certificate: imp.i384100.ne...
    Meta Database Engineer Professional Certificate: imp.i384100.ne...

Комментарии • 11

  • @frank500ish
    @frank500ish 5 месяцев назад +1

    why did you start with static files then move to a react app? can you do one for static files that dont run a server?

  • @yogeshkadu5453
    @yogeshkadu5453 11 месяцев назад +5

    Bro what if i use API url from inspector panel (HTTP//LOCALHOST:3000/API) and call it from my web app i can get response of weather API without needing any KEY. 😵
    I'm not a backend guy but i think you exposed entire weather API while securing your key. 🥲
    Am i wrong ? 😅

  • @JC-fd8ho
    @JC-fd8ho Год назад +4

    how can i secure my firebase api key then ?

  • @floooooo33
    @floooooo33 Год назад +1

    Thank you

  • @navjotsingh2457
    @navjotsingh2457 Год назад

    ty

  • @letsworksimple
    @letsworksimple Год назад +2

    sooo…you can’t really hide a key

    • @OpenJavaScript
      @OpenJavaScript  Год назад +1

      As shown in the video, you can hide a key from users on the frontend, others when sharing your code and even from others with access to your source code on the backend with server-side environment variables.

    • @MrYesnadir
      @MrYesnadir Год назад +7

      No you cant, no matter how much you hide the key in front end, the user agent "browser" from client side still sends the key in get/req/body to api server. Which can be intercepted using tools like burp-suite. even if not visible in source as shown in this video.

    • @JC-fd8ho
      @JC-fd8ho Год назад +2

      @@MrYesnadir wait so how do u actually secure your api key ?

    • @Spirit_69
      @Spirit_69 10 месяцев назад

      i think the best way is to encrypt using cipher