MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Trouble using CORS proxy

    Scheduled Pinned Locked Moved Solved Troubleshooting
    4 Posts 2 Posters 221 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      pclark2
      last edited by

      I am trying to use the built in CORS proxy to call the Jira API. I’ve successfully done this before using CORS Anywhere, but would prefer to use the built in proxy. It seems to be returning an empty result of {}, even though it should return more even if you aren’t authenticated. I’m assuming I am just using the proxy function incorrectly. Below is my code:

      const headers = `Authorization:${"Basic " + btoa(this.config.username + ":" + this.config.apiKey)}`;
      const url = "/cors?sendheaders=" + encodeURIComponent(headers) + "&url=" + encodeURIComponent(`${this.config.jiraInstance}/rest/api/latest/search?jql=${this.config.jiraFilter}&maxResults=${this.config.maxResults}`);
      

      I should note that my coding knowledge is extremely limited, so I am really going beyond my abilities here. Anything here jump out to anyone?

      S 1 Reply Last reply Reply Quote 0
      • P Offline
        pclark2
        last edited by

        I figured out the solution. Simply, I didn’t need the proxy at all and instead just needed to use node_helper.js to make the API call for me. Made sense once I thought of it. I THINK my module is now working fully as expected, but I’ll monitor it over the next week or so to make sure.

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @pclark2
          last edited by sdetweil

          @pclark2 the cors proxy is not full function.
          in my use i do not encode the required url
          i dont supply any parameters to the url
          i also see empty results often

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • P Offline
            pclark2
            last edited by

            I figured out the solution. Simply, I didn’t need the proxy at all and instead just needed to use node_helper.js to make the API call for me. Made sense once I thought of it. I THINK my module is now working fully as expected, but I’ll monitor it over the next week or so to make sure.

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @pclark2
              last edited by

              @pclark2 woohoo!!

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • P pclark2 has marked this topic as solved on
              • 1 / 1
              • First post
                Last post
              Enjoying MagicMirror? Please consider a donation!
              MagicMirror created by Michael Teeuw.
              Forum managed by Sam, technical setup by Karsten.
              This forum is using NodeBB as its core | Contributors
              Contact | Privacy Policy