What is CORS?

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024

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

  • @jeroincababat565
    @jeroincababat565 5 หลายเดือนก่อน +5

    I appreciate that you didn't cut the video when you encountered an error. It demonstrates what happens in real-world coding.

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

      Cool thanks :-)

  • @mib141345
    @mib141345 4 ปีที่แล้ว +25

    You explained in 13 mins what I spent hours reading and not comprehending. Thanks!

    • @Ashotofcode
      @Ashotofcode  4 ปีที่แล้ว

      Glad it helped Doran!

  • @tajsec
    @tajsec 3 ปีที่แล้ว +4

    whole day I was struggling with this :)) your explanation was clearrr, thanksss

  • @maspoetry1
    @maspoetry1 4 ปีที่แล้ว +3

    i merge to the crowd, great video. thanks. I like when you solve the problems in real time, without editing.

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

    I liked that you failed couple of times and then debugged your own code. That actually showed some common mistakes that can be made and should be avoided!

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

      Cool thanks Tedis 😀

  • @moroccan_pentester
    @moroccan_pentester 4 หลายเดือนก่อน +1

    Thanks for this amazing tutorial. it clarifies my knowledge about CORS

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

      You are welcome! Cheers Mark

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

    Props to this guy for live coding.

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

    Thanks a lot, I was scratching my head a lot over this but you explained it briefly yet comprehensively

    • @Ashotofcode
      @Ashotofcode  4 ปีที่แล้ว

      Hi Mujthaba, glad it was helpful 😀

  • @suryakiran2207
    @suryakiran2207 4 ปีที่แล้ว +6

    More simplified, thanks a lot for great explanation.

  • @dhruvpatel6937
    @dhruvpatel6937 7 หลายเดือนก่อน +1

    Very clear explanation, thank you kind sir!

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

      Welcome :-) Cheers Mark

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

    man, thanks a lot for sharing this knowledge. You made this topic very clear to me now!

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

    phenomenal explanation!

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

    Awesome stuff! Thanks for being so clear and the example was very easy to follow:)

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

    Finally, i get it! Thanks.

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

      Glad it helped! Cheers Mark 🙂

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

    wonderfully explained.TYSM

    • @Ashotofcode
      @Ashotofcode  3 ปีที่แล้ว

      Glad it was helpful Shivaram! Cheers Mark :-)

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

    Great explanation. Thanks!

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

    It helped me understand what is CORS and I solved a real world problem. The problem was the origin doesn't support any headers and I was sending one. After I removed, it started working.

    • @Ashotofcode
      @Ashotofcode  4 ปีที่แล้ว

      Excellent, glad it helped Arijeet :-)

  • @anishamalynur7748
    @anishamalynur7748 4 ปีที่แล้ว +3

    hey quick question one of the options to fix the error was "If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled." could you explain this?

    • @Ashotofcode
      @Ashotofcode  4 ปีที่แล้ว

      Hi Anisha, good question, this would be if you simply wanted to check that the service existed, in that it returns a success code, but without any data. I'm not sure when this would be useful, but there are cases I guess. Cheers Mark

    • @dartme18
      @dartme18 4 ปีที่แล้ว

      th-cam.com/video/pDU_jnD2XpE/w-d-xo.html ; different Anisha I assume :-P

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

    Wow, this helped me a lot to comprehend this topic.
    I have one question left though: Why is there Cors Policy by the Browser in the first place? What does it prevent/protect? The api can still be called from outside a browser or I guess there are Browsers that don't enforce the Cors Policies. So how does it protect the Api? Or is this to protect the user in some way?

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

    Thank you!!! I really appreciate the video!

    • @Ashotofcode
      @Ashotofcode  3 ปีที่แล้ว

      Glad it was helpful Aric :-)

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

    best tutorial out there

  • @Muhammad-Hasim
    @Muhammad-Hasim 4 หลายเดือนก่อน

    Watched once subscribed twice.

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

    Awesome video

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

      Thanks! Cheers Mark 🙂

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

    Great video. Helped a lot. Thanks mate :)

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

    well explained! thanks

    • @Ashotofcode
      @Ashotofcode  3 ปีที่แล้ว

      Glad you liked it Timur :-)

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

    very good explanation

  • @jamesscott-nicholson3808
    @jamesscott-nicholson3808 3 ปีที่แล้ว +2

    Thanks for the video, that's cleared it up for me nicely :). If CORS is something only handled by the browser, I suppose that makes it a fairly weak piece of security. Could a browser / extension be made that simply ignores CORS or injects in the necessary header?

    • @Ashotofcode
      @Ashotofcode  3 ปีที่แล้ว

      Thanks James, I'm not really up on the capabitilites of extensions, but they have full control so would think they would be able cause problems here yes. Cheers Mark

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

      yes, you can find extensions in chrome store that disable CORS

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

    So it's all about the back-end setting up CORS headers, and the browser will try to find these headers to determine whether there's CORS violation or not.

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

      Yep that's a good summary I'd say😀

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

    Can cors be exploited if some token is in URL?? (GET METHOD)
    Arbitrary origin is reflected in response with ACAO & ACAC but the token is in URL

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

    it was very helpfull, thank you!

    • @Ashotofcode
      @Ashotofcode  3 ปีที่แล้ว

      Glad it was helpful! Cheers Mark

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

    One question - maybe anyone knows: Why can i not log out the json response one the first .then method?

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

    Thanks great video :)

    • @Ashotofcode
      @Ashotofcode  3 ปีที่แล้ว

      Glad you liked it Louise. Cheers Mark :-)

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

    thx very clear!!

    • @Ashotofcode
      @Ashotofcode  3 ปีที่แล้ว

      Thanks Erdem :-) glad it was useful.

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

    Nice explanation ❤

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

      Glad you liked it Thisura :-)

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

    Great vid, thank you! QUESTION: When the API does not send back the response header [access-control-allow-origins]... I'm assuming it's still sending back the data in the response body... because the decision to show or not is being done by the receiving browser. This seems insecure and dangerous and something a hacker could get around, no?

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

      Thanks! Good question - Yes I think you are correct in that the data will be returned - the browsers are pretty solid though so I would think safe - this takes place internally in the browser so not something you can attack with Javascript really. Cheers Mark

    • @CryptoJitsu
      @CryptoJitsu 3 ปีที่แล้ว

      @@Ashotofcode thanks!

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

    Thank You very much. 🤘

    • @Ashotofcode
      @Ashotofcode  4 ปีที่แล้ว

      Thanks SM, glad it was useful 😀

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

    shot & easy. Thanks

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

    Very clear and useful, yet there is still something my mind can't put hand on : in what are CORS useful ?
    Regarding how easy it is to go arount it... :/

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

      CORS is actually more about relaxing the existing security, so by default only requests from your own site can be made, which is the same-origin policy. With CORS we can allow other sites to access also. So one good scenario is when our API is on a different domain to our website - in this case CORS will allows us to let the website access our API - as otherwise will be blocked by the same origin policy.
      Another case is simply a public API and we want to allows anyone to call it, say a weather api, by default it is restricted to just the domain it runs under, so we add CORS to relax this security and allow anyone to call it.
      So CORS itself is not something to get around - that is the same origin policy - which is pretty locked down in browsers.
      Cheers
      Mark

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

    WoW, Thank you so much!

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

    Thanks for making the video

  • @daminduliyanage
    @daminduliyanage 3 ปีที่แล้ว

    Thank You 👍🏻👍🏻

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

    Excellent ! Thanks !

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

    well done

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

    Arrow functions return by default if code is on the same line.

    • @Ashotofcode
      @Ashotofcode  3 ปีที่แล้ว

      Nice thanks Valetin!

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

    Thanks bro

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

    amazing

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

    Thanks..

  • @smashed5826
    @smashed5826 4 ปีที่แล้ว +5

    The explanation was not deep enough, in this video you just explianed CORS is browser security policy stuff and seeing you tried it out for direct access on browser and via ajax call. It could be deeper to explain why browser needs this; what kind of attacks could be implemented if no this security policy on browser; What headers needs to be added to allow browser calls a cors resource, different browsers or same browser with different versions treat different headers to allow CORS; server side API header settings to control the access the resource in different scenarios etc.

  • @JulienReszka
    @JulienReszka 4 ปีที่แล้ว

    audio is very low volume, I wish it wasn't that low

  • @AzizUllah-j5s
    @AzizUllah-j5s 2 หลายเดือนก่อน +1

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

    Confusing for me...

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

    RIP, SWAPI

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

      D'oh yep it has died!

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

      @@Ashotofcode Someone posted a duplicate pretty quickly after SWAPI died (that was six months ago I think?). Our company used SWAPI for interview exercises, so we were happy to see the replacement!

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

      @@dartme18 Ah yes, swapi.dev, cool thanks!

  • @aravind4444
    @aravind4444 4 ปีที่แล้ว

    please explain with diagram

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

    => return

    • @Ashotofcode
      @Ashotofcode  3 ปีที่แล้ว

      Ah yes that one gets me a lot! thanks

  • @addtyu6176
    @addtyu6176 4 ปีที่แล้ว +5

    I closed the video immediately after seeing Microsoft Edge being used....

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

    +

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

    very poorly explained, uses tools people may not be familiar with, the actual subject is almost ignored