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.

    missing 'Access-Control-Allow-Origin'

    Scheduled Pinned Locked Moved Troubleshooting
    10 Posts 6 Posters 6.0k Views 5 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.
    • paviroP Offline
      paviro Admin
      last edited by

      Just use a node_helper.js to get around the access-allow-origin policy.

      We're all stories in the end. Just make it a good one, eh?

      – The Doctor

      1 Reply Last reply Reply Quote 0
      • BangeeB Offline
        Bangee Module Developer
        last edited by

        After googleing 1000 different websites I’ve used the nood_helper.js solution.

        And to load the nood_helper.js I had to restart electron. pm2 restart mm
        that coast me another hour to find out why it was no loading :-):gun: :hammer:

        1 Reply Last reply Reply Quote 0
        • K Offline
          KrawallKurt
          last edited by

          I am facing the same problem. Could you please give an example, how you used node_helper.js to circumvent the access-allow-origin policy?

          Thanks!

          1 Reply Last reply Reply Quote 0
          • yawnsY Offline
            yawns Moderator
            last edited by

            Like here for example:
            https://github.com/yawnsde/MMM-RNV

            You use request instead.

            1 Reply Last reply Reply Quote 0
            • K Offline
              KrawallKurt
              last edited by KrawallKurt

              Thank you!

              And why does it have to be in node_helper, not in the main script? Sorry, if this question sounds stupid, I’m new to developing modules.

              Also, is there a reason for declaring var self = this; and using self.func instead of this.func? I have seen this quite a bit and couldn’t understand why people do this…

              yawnsY 1 Reply Last reply Reply Quote 0
              • yawnsY Offline
                yawns Moderator @KrawallKurt
                last edited by

                @KrawallKurt
                Please note I am not an experienced javascript developer either. When using addon modules/libraries like request you use the node_helper.js to load this library. I am not sure if it is not possible at all to do so in the main module file or if it is just complicated. Maybe @strawberry-3-141 can clarify :)

                self = this was used in other modules and I added it to my module as well, because I did not want to possibly break something by leaving it out. There is a lot of discussion on the web why this is used and if this still should be used.

                1 Reply Last reply Reply Quote 0
                • K Offline
                  KrawallKurt
                  last edited by

                  Concerning the self=this question, I found a neat article giving som explanations: https://alistapart.com/article/getoutbindingsituations

                  The other question: Could it be, that node_helper is executed on the server and the main script is executed on the client?

                  1 Reply Last reply Reply Quote 0
                  • 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