https://lemmy.ml/api/v3 works for lemmy.ml, but when I try it with lemmy.world it gives bad request, any help?

    • Yoru@lemmy.worldOP
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      hmm, interesting. It works when I do it in my node environment, but the moment the browser tries to make the request it fails.

      • nickel@lemmy.world
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        1 year ago

        @[email protected] - it has to do with CORS (says in the error message) - You generally can’t make cross-origin requests in the browser unless it is explicitly allowed. This is purely a browser limitation, which is why it works in your node environment. But if you open the console on any random website and try to call fetch() to that API, it’s going to fail on any site other than lemmy.world.

        • Yoru@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          yeah that’s what I observed after a few more trying, is there a possible workaround to this?

          • nickel@lemmy.world
            link
            fedilink
            English
            arrow-up
            3
            ·
            1 year ago

            Anything you do cross-origin will have to be done in a server-like environment instead of in the browser.