5 JavaScript API Key Mistakes (and how to fix them)

แชร์
ฝัง

ความคิดเห็น • 129

  • @samisaacvicliph
    @samisaacvicliph 2 ปีที่แล้ว +33

    Hi James, thank you very much for this video. I would very much like to see an explanation about JWTs and common mistakes while using them - especially around the storage of these tokens and securly sending and receving it from the back-end.

  • @JC-jz6rx
    @JC-jz6rx 2 ปีที่แล้ว +37

    Please PLEASE make a follow up. This is such an important concept and most tutorials and sources don’t give it enough attention. I’m currently struggling with these concepts myself.
    I can build a backend and secure a server side application. But I have no idea how to go around protecting a request from the front end for example. I had been stuck on how to handle API requests that require a token called from a front end application. This video gave great input on it

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว +11

      I’ll get to work on that :)

    • @amystout8696
      @amystout8696 2 ปีที่แล้ว +1

      @@JamesQQuick YAY!! Thank you!

    • @msc8382
      @msc8382 2 ปีที่แล้ว +4

      I used a server side rendered http only secure cookie over SSL (HTTPS) connections. With each request from a browser, the cookie is sent along with encoded information that is bound to user bound session data that automatically invalidates itself without user interaction.
      Here's the full story, it's REALLY long:
      In this cookie I store information that is encoded/encrypted by the server so its hard for normal people to read it (security by obscurity step).
      I bind user information to the cookie, so that the value cannot be used to impersonate another user (security by isolation).
      A session is instantiated by the server with an guaranteed unused session id. The session contains one encryption key, and one validation key. The validation key is part of the encrypted payload.
      The session id is also stored in the cookie, but not encrypted and serves as a way to bind a user and session together using a cookie.
      Each time the cookie is sent to the server, it can quickly lookup the associated session, decrypt the payload using the random generated encryption key, and validate the cookie stored validation key with the session stored validation key.
      If I'm sure I'm only going to use short living sessions, I also encode IP information into the session and compare it when the cookie is send. If any of the data does not match up, the cookie is tampered with and the session and cookie van be invalidated. This is a simple way to force The Union Router (TOR) users to login again when their IP changed without them realizing, and thus preventing compromising their session. It also prevents networking traffic inside a user network from being rerouted to a different internet exit point, as the user device will access the server with a new IP by then.
      The session automatically invalidates after some time of no activity.
      If the cookie is using a session that no longer exists, the server will try to recover it from archiving, or create a new session and update the cookie. It can be a heavy feature to browse through a database full of archived session data.This process is intentionally made relatively slow but steady with a limited resource pool, to prevent DDOS from bringing this feature down. Its very possible the server denies creating a new session unless the user supplies login credentials again or enough resources become available for processing. The bound information also includes a date of expiration, so that if a cookie's expiration date is tampered with, we can invalidate it and block user access.
      PS: I often also add a random generated string to a long-term stored user account, and use that code to encode random values. This makes it harder to further analyze random generated patterns unless you know about the encoding happening And even then you have to break into the server-side storage to get the user-stored random string.
      This is how I do it, may sound convoluted but every step is crafted in a way to prevent any form of corruption on server side (for example, due the server being DDOS'ed) with minimal performance hit, but with maximum security I could envision. The server uses atomic operations to operate on all the values, which allows the greatest guarantee to prevent corruption by computer instructions going bad.
      I thought of different methods such as using no sessions, using simpler data, not using as much random strings but I found ways to corrupt the system without them. Besides, using sessions allows me to store dynamic session data and check permissions on the server side easily, which is useful for having stateful applications such as frontend editors with caching and stream support. I wanted to be sure that people could relatively stream data safely and that the server could process it fully in parallel and asynchronously, sacrificing a fraction of speed for stability and security.
      This approach is something I concocted that can be made to work in a distributed computation network such as server parks using only simple synchronization techniques (like using TCP and just send over formatted data). I use sessions to store information about how the user data is distributed over the system.
      To pull off stealing someone's session with this approach, you'll have to do a man in the middle attack or hijack the internet exit point, hack into the browser of a user to get session bound data. Fabricating a cookie using random data is out of the question, because if any of the stored cookie data does not match up with the session, it is not deemed valid. At this point, the attack vector is people who can directly access your computer or people who have compromised browsers. There's nothing you can do against that.
      It may not be the answer you're looking for but I hope it was insightful nonetheless.
      Feel free to criticize my approach. I'm not a security specialist. Definitely tell me if you have more secure methods if you are a specialist!

    • @JC-jz6rx
      @JC-jz6rx 2 ปีที่แล้ว +2

      @@msc8382 WOW, That was like reading a medium article. Thank you for taking the time to write this out. The IP address encoding you do along with the sent cookie is genius, i hadnt thought of that. especially for users on vpns or TOR. Up to now i had just be authing with credentials and a jwt cookie but without any of the extra data. This definitely gave me some ideas. will be saving this in my notes.

    • @DeGuoTaiKe
      @DeGuoTaiKe 11 หลายเดือนก่อน

      Most viewers would be interested on a proxy backend API endpoint demo with load limits. We don't need a production stable app, just an app that is safe regarding exposing our API key (mostly to avoid high bills).

  • @bradgarropy
    @bradgarropy 2 ปีที่แล้ว +11

    Great video as always, I've made plenty of these mistakes!
    Here's a little tip, I like to ignore ".env*" instead of typing out each different environment file permutation.

    • @everyhandletaken
      @everyhandletaken 2 ปีที่แล้ว +2

      Came to see if someone had mentioned exactly that tip - possibly also *.env as well, as I have seen local.env, for example (not sure if it was with dotenv package, or something else)

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว +2

      Yep I do the same except when I have a .env.example file that I want to leave in for other users to get started

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว +2

      Haha Brad nailed it!

    • @filips7158
      @filips7158 2 ปีที่แล้ว +2

      Then do :
      .env*
      !.env.local

    • @a.galvaop.787
      @a.galvaop.787 2 ปีที่แล้ว

      It's a common thing to leave a .env.example file with the description of the vars on it. If you do that you won't be able to have that file.

  • @everyhandletaken
    @everyhandletaken 2 ปีที่แล้ว +6

    I really don't understand why, in 2022, there isn't an encrypted & protected enclave within the browser to load env params, which are never visible to an end user. Perhaps it is not possible, but it seems like it should be (for people much smarter than I am).
    The example in the video is a perfect case as to the necessity to add further layers of abstraction, which may be to protect just 1 api key..
    Great video & hope this saves someone the pain of leaking env's!

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว +2

      Interesting take!

    • @everyhandletaken
      @everyhandletaken 2 ปีที่แล้ว +3

      @@JamesQQuick I’m an optimist, if nothing else 😂

    • @MarkusEicher70
      @MarkusEicher70 2 ปีที่แล้ว +1

      @@everyhandletaken Me too. You were absolutely right about encrypted and protected layer for this kind of authentication via API's. There must be a way to do this without exposing the secrets to the whole internet. I mean we are trying to reach Mars. Have a good time and thanks for your answer. I back this 100%.

  • @Allformyequine
    @Allformyequine 2 ปีที่แล้ว +5

    PLEASE PLEASE do the follow up! This is for sure another pain point for folks just learning about how to handle API's and most like you said thought if you used the .env file that it might be ok but we see here that is NOT enough! Also, can you add a short part about how to possibly remove it completely if it did accidentally get pushed up to Github? Your stuff rocks THANK YOU!!!!

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว +2

      Glad you enjoyed it. For the “accidentally pushed to GitHub” there’s not really a way to completely remove. You need to regenerate a new key. I’ll work on the extra video too :)

    • @amystout8696
      @amystout8696 2 ปีที่แล้ว

      @@JamesQQuick Oh wow ok gotcha!! Thank you!

  • @lukem7176
    @lukem7176 6 วันที่ผ่านมา

    Hi James 😀, what if I have aa APY KEY protected backend that needs to be accessible from the frontend (React)? how can I hide my backend api key?

  • @TheKing-xr3zn
    @TheKing-xr3zn 2 ปีที่แล้ว +1

    Cors is good if backend consuming from website but if you have mobile app?

  • @lexiriam
    @lexiriam 3 หลายเดือนก่อน

    So, this is only for node.js or react apps? Is there a way for vanilla javascript and php? I'm using google maps for a website on a shared host server (they don't offer node.js or react). I'm seeing a bunch of videos like this that provide information on hiding api keys, but they all fall under having node.js or react. Before anyone says, well, just move the website to a dedicated server with node.js/react. I can't. It has to be on that hosting server provider. :(

  • @GavHTFC
    @GavHTFC 2 ปีที่แล้ว

    Thanks for this video James, it was actually Ania's video that led me here and it's an issue I've been wrestling with for longer than I'd like to admit!

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว +1

      Ah so cool! Glad it helped :)

  • @ChrisMcFlyDude
    @ChrisMcFlyDude 2 ปีที่แล้ว +3

    Excellent video on a relevant topic. I solve this problem by issuing a unique CSRF token (Cross Site Request Forgery) from my API to the FE page that is consuming a public resource from my API. I persist the token in a DynamoDb table.
    Then each subsequent request from the FE needs to pin the token to the request header e.g X-CSRF-Token. Then server-side I validate the token by looking it up in the DynamoDB table. If the token exists I know that the request is valid. Tokens can be designed to be one time or multiple use. They can be time base and have an expiry (which should be short).
    This, combined with rate limiting and an API key will offer a good level of protection from someone abusing your public end-points.

    • @Subs-rj3zk
      @Subs-rj3zk 2 ปีที่แล้ว

      CSRF Tokens can't defend against this. You can have a workflow using Postman/Insomnia/HttpClient to call the csrf token endpoint, extract the token from the response, inject to the next request.
      Security is a real challenge for frontend development.

    • @Goku-xm1gq
      @Goku-xm1gq ปีที่แล้ว

      CSRF token should only be provided to authenticated and authorized users who have a valid session.
      @@Subs-rj3zk

  • @vasiovasio
    @vasiovasio 2 ปีที่แล้ว

    Great video James - Objective, honest, and on point, without unnecessary things!

  • @danielrocha5774
    @danielrocha5774 2 ปีที่แล้ว

    what if don't want to make localhost:3000/weather data available to all users, just to the ones that are authenticated?

  • @meto735
    @meto735 ปีที่แล้ว

    I have an api-key error case, my api-key is case sensitive, in javascript my execution does not progress, due to the error it shows in api-key, please does anyone know how to solve it?
    "x-api-key": "swGwRN7X65XLuBqFFsthpwxMjhXjxL9CrUmvtW70"
    error displayed: message: 'The request message is not properly formatted.'

  • @lfbarni
    @lfbarni ปีที่แล้ว

    Sure I need more help and explanations about how to solve the problem number four 😂. Nice video!

  • @amystout8696
    @amystout8696 2 ปีที่แล้ว

    I'm already making popcorn for the follow up :)

  • @Allformyequine
    @Allformyequine 2 ปีที่แล้ว

    So would this also be true for using an API to say gather just simple blog posts from a CMS; I mean do you need to get special tokens for that type of application?

  • @khalilbessaad5553
    @khalilbessaad5553 ปีที่แล้ว +1

    Actually you can use env variables in Astro if you're not using your API keys in client side code. Since Astro runs in build time, the requests that need the API keys will be sent during build time and no js code with the API keys would be shipped to the user.

  • @sportsstimulant4228
    @sportsstimulant4228 ปีที่แล้ว

    Suppose in react before push it github or hosting craete .ENV file and write REACT_SECRET_API_KEY=abcd...........etc etc
    And my index.js file code {process.env.REACT_SECRET_API_KEY} then add .ENV file to . gitignore after that if i push it github then okay or probelm ? I mean can hide my api key that's way ??

    • @DeGuoTaiKe
      @DeGuoTaiKe 11 หลายเดือนก่อน

      Your key would not be exposed since you did not upload it to the internet, but accordingly your app also could not read the key as it cannot access .env.

  • @jamcmich
    @jamcmich 2 ปีที่แล้ว

    Is it okay to expose an API Key that is limited and retrieves information for demonstration purposes (i.e. demo projects hosted on GitHub Pages)?

  • @goldfishbrainjohn2462
    @goldfishbrainjohn2462 2 ปีที่แล้ว +3

    Should use other API as an example because there are two different types of API keys, Public and private API keys.
    Public API keys, like Google Map API key, for example, will be always exposed to the internet because you need the key to access the map. This kind of keys should be restricted by limiting IP addresses, referer or domains to secure the usage.
    Private API keys are for internal use, for example: APPs to APPs or servers to servers communication, so they shouldn't be exposed to public. Instead, they should be secured by ways mentioned in this video.

  • @angelsoto819
    @angelsoto819 ปีที่แล้ว

    Thank you so much this helped a ton James!!

  • @desireebryant9523
    @desireebryant9523 2 ปีที่แล้ว

    Do I have to give the web developer the secret key to implement the payment method?

  • @knufflpuffl
    @knufflpuffl 2 ปีที่แล้ว +1

    Ok, this obviously works fine when using node.js, but what if you are using client side Javascript?
    Afaik the only way to hide the keys here is by doing a custom request to your own server instead of sending it directly, am I right about this?

    • @MarkusEicher70
      @MarkusEicher70 2 ปีที่แล้ว

      Thanks for this question, Daniel. This would be interesting to know for me too.

  • @MuratKeremOzcan
    @MuratKeremOzcan 2 ปีที่แล้ว

    gitignore and put it in CI, what else is there

  • @Notoriousjunior374
    @Notoriousjunior374 2 ปีที่แล้ว +1

    As long as it’s being used on the client, the key can still be seen on the browser if you dig deep into it, no? Unless you mask it with a serverless function then yes it’ll be completely hidden.

    • @sayamqazi
      @sayamqazi 2 ปีที่แล้ว

      but then that function can be invoked by anyone. :D how do you protect that. Anything that has to be client side can simply not be hidden.

    • @Notoriousjunior374
      @Notoriousjunior374 2 ปีที่แล้ว

      @@sayamqazi I meant the key will be hidden if you use serverless function, it does not mean you can prevent people from using it. What exactly do you mean by protection? What are you trying to keep hidden? A serverless function already hides that for you.

    • @sayamqazi
      @sayamqazi 2 ปีที่แล้ว +1

      @@Notoriousjunior374 Oh got it. But what's the point of hiding key. if the attacker can just move his goal post now.

    • @Notoriousjunior374
      @Notoriousjunior374 2 ปีที่แล้ว

      @@sayamqazi These answers can easily be found on the internet. It’s your choice whether or not you want to expose to the client. You can implement any features on your end. For example you may have an api key that has access to your crypto wallet and that you can perform trades with it. You’re planning to ask your fans to buy any shit coins for you but of course you’ll want to have some kind of limit that your fans will not be able to do. Hide that key from them and do write some custom functions to do whatever you want. It’s really that simple.

  • @rolandabellano
    @rolandabellano 2 ปีที่แล้ว

    Thanks for this video, james. Yes, a demo would be nice.

  • @MarkusEicher70
    @MarkusEicher70 2 ปีที่แล้ว

    Hi James. Thanks a lot for this post! I'm still learning about securely using my API keys. It seems that this will be a long, long way to go. I almost can't believe that there are no more robust and secure methods implemented in modern browsers. Seems like one has to go to university to be able to securely use widespread API's. But hey, let's figure it out. I like your content, and thanks again.

  • @richardday8843
    @richardday8843 2 ปีที่แล้ว +1

    Please suggest in detail how to manage multiple dev/test/production .env files shared among multiple developers and testers.
    Also, how would ex-developers (potential saboteurs) be denied access? Generate new keys and rebuild/redistribute a new generation of .env files?
    Also, please address Pavel Pirogov's comment that many api keys are host-limited, apparently mitigating key secrecy as a serious issue.

  • @nicholassingh138
    @nicholassingh138 2 ปีที่แล้ว

    Hey bro. How much longer before the everything svelte course is dropped?

  • @prashanthss
    @prashanthss ปีที่แล้ว

    Thanks James. Properly put up in an order to understand

  • @jinyoucheng8114
    @jinyoucheng8114 2 ปีที่แล้ว

    Hi, James. Thank you so much for this valuable video. Actually I have stored all my env variables in vercel, but when I see in browser/inspect/source tab, I could see all of them even though my github username, developer key etc which is very sensitive info. How to hide them? 🙏🙏🙏🙏

  • @waffletube5707
    @waffletube5707 ปีที่แล้ว

    I guess what I don’t get is, yes I want to minimize exposing my api key or auth token via github or dev console, but I also want people to use the app I’ve made without having to make an account and login. Don’t some of these approaches go a little too far in “protecting” the keys? What’s the trade off if people can’t even use the thing. And what’s to stop multiple accounts from signing up and spamming your key anyway?

    • @JamesQQuick
      @JamesQQuick  ปีที่แล้ว

      It certainly does seem like a lot. The simple fact is if you expose your keys, they can be used by anyone to spam your content so you certainly don't want that espceially for paid products. To the question of, couldn't users spam your content anyways...yes, they could, but at least that way, they don't have direct access to the key AND you can throttle or even remove a user. You can also put general throttling logic in your application to help prevent it to start.

  • @groovebird812
    @groovebird812 2 ปีที่แล้ว +1

    I also like to see a follow up video with all the security stuff :-)

  • @owlyone
    @owlyone 2 ปีที่แล้ว

    Actually this would be so great to cover more specifically incl. demo of best practices ! :D

  • @ygvanz
    @ygvanz 2 ปีที่แล้ว +2

    Would like to see a demo of this explanation

  • @HugoDuprez449
    @HugoDuprez449 2 ปีที่แล้ว

    So there no solution to prevent a stranger to trigger our backend from a server ? (Apart login auth)
    A simple like counter which is available for guests (no login) that be stored in a db can’t be secured to a stranger call?

  • @mdbdrrhm
    @mdbdrrhm ปีที่แล้ว

    Cannot not use npm dotenv package in vanilla JavaScript.

    • @JamesQQuick
      @JamesQQuick  ปีที่แล้ว

      Well you also wouldn't include private credentials in a frontend vanilla JavaScript site

  • @marouaniAymen
    @marouaniAymen 2 ปีที่แล้ว +2

    Thanks for you video, what about JavaScript UI applications (in React namely) where they run on Docker ? We run into a problem with this Dockerized apps because in our DevOps "Philosophy" we build one image independently from the environment (remote DEV, UAT, PREPROD, PROD) and we want to add environment related variables later, in Java it works well, because the java applications can read from a property file shipped out of the container, but in JavaScript I didn't hear about an application reading properties from an external file, did you encounter a situation like this ?

    • @younkerssynapse2920
      @younkerssynapse2920 2 ปีที่แล้ว

      You can pass env: ./env and pass in .env file for environment variables

    • @everyhandletaken
      @everyhandletaken 2 ปีที่แล้ว

      Not entirely sure I understand, but you can pass an env file to Docker container using arguments when you run the container, or in a docker-compose file & the env file is picked up from outside of the container. Not sure if this could be a remote path, but can be anywhere on the filesystem of the Docker host. I may be misunderstanding though, sorry.

  • @ankurmay10
    @ankurmay10 2 ปีที่แล้ว

    shouldn't we use a vault service to securing your API key and get api key dynamically to request backend.

  • @fahd2372
    @fahd2372 2 ปีที่แล้ว

    Great video as always!

  • @Stefan-jh8or
    @Stefan-jh8or 2 ปีที่แล้ว

    Hey James, I recently being diving in deeper in this topic and I been learning a new tool API managmenebt and Key Vault. Was wondering if you have knowledge on or could do a video about key vaults?

  • @AhmedSM8
    @AhmedSM8 2 ปีที่แล้ว +2

    Thats where i am stuck i created proxy node backend but i think its useless now because you can call it directly and get the data😂😂😓

  • @borakayalar
    @borakayalar 2 ปีที่แล้ว

    i wait more detailed videos. This issue more important. Thanks

  • @pastuh
    @pastuh 2 ปีที่แล้ว

    Not so much info about Chrome extensions and JWT. Would be nice to see some tips/tricks :)

  • @Dabayare
    @Dabayare 2 ปีที่แล้ว

    Why not have it on a database on the web, then construct a class with private values if ur shipping an app with API keys.

  • @usmanshahid8529
    @usmanshahid8529 2 ปีที่แล้ว

    Which theme u are using ??

  • @HansWurst-dk6pp
    @HansWurst-dk6pp 2 ปีที่แล้ว

    I have to use Google Maps in a project. I was wondering if anything that you said would apply for the Google API key, but I guess it doesn't. Google forbids using Maps with a proxy as far as I know. Restricting the key to a host (via Cors in the Google account settings) is the only possible protection I guess.

  • @lyespatrick7438
    @lyespatrick7438 2 ปีที่แล้ว

    That was very helpful thank you.

  • @iiWolff
    @iiWolff 2 ปีที่แล้ว +2

    Good video, can you do a follow up with actual examples? Cheers

  • @rugeneus
    @rugeneus 2 ปีที่แล้ว

    Very impotant video! Thank you! Please, make video about JWT!

  • @Confusedcapybara8772
    @Confusedcapybara8772 2 ปีที่แล้ว

    Absolutely need a demo with some visuals

  • @badunius_code
    @badunius_code 2 ปีที่แล้ว +1

    DevTools > Network > see api key in plain text in the request
    =/

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว

      encrypted over https...

    • @badunius_code
      @badunius_code 2 ปีที่แล้ว +1

      @@JamesQQuick it's in the url I can see. Any other user can see it too, duh =)

    • @dgro949
      @dgro949 2 ปีที่แล้ว

      A problem with public-facing web pages.

  • @VonnieKinsey
    @VonnieKinsey 2 ปีที่แล้ว

    Vercel environment vars work great for prod. Thought you maybe are highlighting this as not the best solution.
    NextJs newer version of 12 has resolved the ability to get env vars into the front-end. If the var is prefixed with NEXT_PUBLIC_..., then the value is return and not return of a blank. Although, it only works for NextJs. And, I do believe Vercel's NextJs would offer this only if it were secure approach.

    • @panicbox4609
      @panicbox4609 2 ปีที่แล้ว +1

      It sucks though cause how do you use a api key that is stored on vercel client side with out it being exposed to the client

    • @panicbox4609
      @panicbox4609 2 ปีที่แล้ว

      So people won’t see the key

  • @elAmigo805
    @elAmigo805 2 ปีที่แล้ว +1

    Please make a demo. Even if it's a multipart video to avoid all mistakes.

  • @kareng9484
    @kareng9484 6 หลายเดือนก่อน

    Thank you ❤

  • @dasdunetechnologies1695
    @dasdunetechnologies1695 2 ปีที่แล้ว +1

    Backend protection, use Firebase auth with custom claim with JWT

    • @MarkusEicher70
      @MarkusEicher70 2 ปีที่แล้ว

      Hello DasDune Technologies. Thanks for the tip. Appreciate it. I will check that out for sure. Have a good time.

  • @kiyoshitanaka4023
    @kiyoshitanaka4023 2 ปีที่แล้ว

    Can you please make an Tutorial on SSR Streaming with Next.js

  • @incarnateTheGreat
    @incarnateTheGreat 10 หลายเดือนก่อน

    I've been burned by this before. I'm happy for Nextjs 14's server-side implementation to allow for secure calls. However, if you don't have Nextjs, these tips are still good. Thanks.

  • @JimKernix
    @JimKernix 2 ปีที่แล้ว

    That is so many files and folders for the project you are showing. How do you even learn to create all those? It's overwhelming.

    • @JimKernix
      @JimKernix 2 ปีที่แล้ว

      Yes on the DEMO!

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว +1

      Haha totally understandable. The main thing is that those files get created one bit at a time. That’s whT comes with experience is being able to break down something big into smaller components

  • @digimbyte
    @digimbyte ปีที่แล้ว +1

    these are not effective solutions, there are ways to read and expose keys.
    this only covers accidental key leaking but does NOT cover actual security.
    such as tricking an api end point to return its environment variables.

  • @graa999
    @graa999 2 ปีที่แล้ว +1

    People just do not understand security at all. All that .env bullshit about api keys ruins here: anyone can open devtools, network tab and see all exact headers browser sends to 3rd party api including your 'secret' key

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว

      The whole point is that you don't include the API key on the frontend because of that...

  • @the_allucinator
    @the_allucinator ปีที่แล้ว

    CORS is not enough. A simple HTTP Request (not XHR) can bypass CORS. CSRF.

  • @andreslaramesa745
    @andreslaramesa745 2 ปีที่แล้ว +3

    Deeper please!

  • @danser_theplayer01
    @danser_theplayer01 2 ปีที่แล้ว +2

    So I with 0 dollars in my pocket basically can't use any API because I don't have a server to make it secret... veb dev is a giant headache.

    • @KuopassaTv
      @KuopassaTv หลายเดือนก่อน

      Sell your phone

  • @b14ckdrag0n
    @b14ckdrag0n 2 ปีที่แล้ว +1

    Yes, but after building a pure react app the environment variables are injected into the code, not called by process but actually hard coded into the build files

  • @mr.angshuman
    @mr.angshuman 2 ปีที่แล้ว

    Please make the follow up video

  • @lucasrmendonca
    @lucasrmendonca 2 ปีที่แล้ว +1

    Aww this time Cap guy did not make a cameo in the video intro

    • @JamesQQuick
      @JamesQQuick  2 ปีที่แล้ว

      Haha I’ll add him back!

  • @rathapongp426
    @rathapongp426 2 ปีที่แล้ว

    Do you not sing a song anymore?

  • @panicbox4609
    @panicbox4609 2 ปีที่แล้ว

    Please make follow up video

  • @DeGuoTaiKe
    @DeGuoTaiKe 11 หลายเดือนก่อน

    Firebase App Check might be a possible solution.

  • @smithoo7646
    @smithoo7646 2 ปีที่แล้ว

    This is what I wanted

  • @PavelPirogov
    @PavelPirogov 2 ปีที่แล้ว +3

    This is stupid! Most services that require api keys provide keys for exact host and if request goes from another host key will not work. So there are no reason to hide your api key because noone else would be able to use it any way. And if service allow one key to be used from any host that would mean that there is nothing bad can happen if someone else will use your key because there are no functionality to make any damage to you. Usually no host check would mean that it's purely made and it's better not to use this service.

    • @MarkusEicher70
      @MarkusEicher70 2 ปีที่แล้ว

      Hi Pavel. Thank you for your answer. I'm relatively new in this field. I started learning to code earlier this year, but I care a lot about security and I want to learn how to do things the right way. If I understand you right, then a good API specification is using API keys that are bound to a certain host and can only be used on this host but not from any other than this. This seems to make perfectly sense for me. You advise that we should better not use any API's that allow the use of API keys from a random host. Did I get this right? At this point I'm not dealing with securing one of my own applications, because I have not coded one. All I want to do now, is learning to consume API's with JavaScript's fetch or with curl. After seeing this video I almost think that there is no way to do that in a very secure way. To be honest, I will look for API's to learn with that do exactly what you described here. I want to find some good examples that use host bound API's. Thanks again and have a good time.

  • @hesamalavi9
    @hesamalavi9 2 ปีที่แล้ว

    Yes, demo please :D

  • @virtualalphastudios6149
    @virtualalphastudios6149 2 ปีที่แล้ว +1

    Firebase does all of this so it's all secure with Firebase

    • @Allformyequine
      @Allformyequine 2 ปีที่แล้ว

      ** I think Supabase might do this also...?

    • @virtualalphastudios6149
      @virtualalphastudios6149 2 ปีที่แล้ว

      All I know about Supabase is it does not have everything Firebase has yet.

  • @DuyTran-ss4lu
    @DuyTran-ss4lu 2 ปีที่แล้ว

    Great

  • @Systemscai
    @Systemscai ปีที่แล้ว +1

    whats the point of this video?

  • @NH-cb2jg
    @NH-cb2jg 2 ปีที่แล้ว +1

    So you didn't explain how to solve it. Nice. What a waste of time.

  • @sonic-c3l4q
    @sonic-c3l4q 14 วันที่ผ่านมา

    This was nonesense. Never provided an actual tutorial on how to solve the problem with what specific steps.

  • @ming3957
    @ming3957 2 ปีที่แล้ว