<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Creating Module with API Key/Secret]]></title><description><![CDATA[<p dir="auto">I read the “Head first developing MM module for extreme beginners” but I am still confused how I can configure it.</p>
<p dir="auto">I want to create a MM-Yelp</p>
<p dir="auto">I created my app on Yelp Fusion and I have an api_key and secret. Where do I store this api_key? My main.js or into my node_helper.js?</p>
<p dir="auto">Sorry, I am a total beginner with JS</p>
]]></description><link>https://forum.magicmirror.builders/topic/11321/creating-module-with-api-key-secret</link><generator>RSS for Node</generator><lastBuildDate>Thu, 13 Aug 2026 00:24:47 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/11321.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Oct 2019 22:47:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Wed, 16 Oct 2019 20:45:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lilpkstud" aria-label="Profile: lilpkstud">@<bdi>lilpkstud</bdi></a> cool… if need it in strings someplace, need to convert it back object=JSON.parse(string)</p>
]]></description><link>https://forum.magicmirror.builders/post/62794</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62794</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Wed, 16 Oct 2019 20:45:09 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Wed, 16 Oct 2019 20:44:04 GMT]]></title><description><![CDATA[<p dir="auto">@sdetwell @strawberry-3-141 thanks guys got it to work!</p>
<p dir="auto">I used JSON.Stringify() to look at the data when I was console.loggining so that was the reason why my object were turning into strings</p>
]]></description><link>https://forum.magicmirror.builders/post/62793</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62793</guid><dc:creator><![CDATA[lilpkstud]]></dc:creator><pubDate>Wed, 16 Oct 2019 20:44:04 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Wed, 16 Oct 2019 16:21:13 GMT]]></title><description><![CDATA[<p dir="auto">@strawberry-3-141 should call it api_data maybe!</p>
]]></description><link>https://forum.magicmirror.builders/post/62760</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62760</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Wed, 16 Oct 2019 16:21:13 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Wed, 16 Oct 2019 16:20:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lilpkstud" aria-label="Profile: lilpkstud">@<bdi>lilpkstud</bdi></a> next to what sdetweil said you should also not save your result into this.data as it is an instance property which already contains data, see <a href="https://github.com/MichMich/MagicMirror/tree/master/modules#available-module-instance-properties" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/MichMich/MagicMirror/tree/master/modules#available-module-instance-properties</a> for reference</p>
]]></description><link>https://forum.magicmirror.builders/post/62759</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62759</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Wed, 16 Oct 2019 16:20:20 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Wed, 16 Oct 2019 12:17:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lilpkstud" aria-label="Profile: lilpkstud">@<bdi>lilpkstud</bdi></a> said in <a href="/post/62716">Creating Module with API Key/Secret</a>:</p>
<blockquote>
<p dir="auto">JSON.stringify()</p>
</blockquote>
<p dir="auto">correct… u converted the object to a string…  don’t need to do that</p>
<p dir="auto">just pass the object from helper up to module …</p>
<p dir="auto">then it will use the <a href="http://this.data.name" target="_blank" rel="noopener noreferrer nofollow ugc">this.data.name</a></p>
]]></description><link>https://forum.magicmirror.builders/post/62729</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62729</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Wed, 16 Oct 2019 12:17:44 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Wed, 16 Oct 2019 00:12:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lavolp3" aria-label="Profile: lavolp3">@<bdi>lavolp3</bdi></a></p>
<p dir="auto">This line of code will show a { on my mirror so I’m assuming everything is turned into a string?</p>
<p dir="auto">I used JSON.stringify() in my node_helper file</p>
<pre><code>            wrapperDataRequest.innerHTML = this.data[0];

</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/62716</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62716</guid><dc:creator><![CDATA[lilpkstud]]></dc:creator><pubDate>Wed, 16 Oct 2019 00:12:26 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Tue, 15 Oct 2019 22:34:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lavolp3" aria-label="Profile: lavolp3">@<bdi>lavolp3</bdi></a> I deleted <a href="http://this.data.name" target="_blank" rel="noopener noreferrer nofollow ugc">this.data.name</a> because I was getting undefined and I still am</p>
]]></description><link>https://forum.magicmirror.builders/post/62714</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62714</guid><dc:creator><![CDATA[lilpkstud]]></dc:creator><pubDate>Tue, 15 Oct 2019 22:34:59 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Tue, 15 Oct 2019 22:23:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lilpkstud" aria-label="Profile: lilpkstud">@<bdi>lilpkstud</bdi></a> this.data is an object, not an array. So <a href="http://this.data.name" target="_blank" rel="noopener noreferrer nofollow ugc">this.data.name</a> should do the trick. In the code above you have only this.data!?</p>
]]></description><link>https://forum.magicmirror.builders/post/62710</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62710</guid><dc:creator><![CDATA[lavolp3]]></dc:creator><pubDate>Tue, 15 Oct 2019 22:23:26 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Tue, 15 Oct 2019 21:57:29 GMT]]></title><description><![CDATA[<p dir="auto">Having trouble displaying the information that I received from Yelp API</p>
<pre><code> getDom: function() {
        var self = this;
        var wrapper = document.createElement("div");
        //If this.dataRequest is not empty
        if(this.data &amp;&amp; this.data.length &gt; 0){
            console.log("MMM-Test: This.data is set" + this.data);
        
            //Name of Business
            var wrapperDataRequest = document.createElement("h1");
            wrapperDataRequest.innerHTML = this.data;
            wrapperDataRequest.className = 'yelpBusinessName';

            wrapper.appendChild(imgDataRequest);
            wrapper.appendChild(wrapperDataRequest);
        } else {
            console.log("MMM-Test: this.data couldn't be found");
            wrapper.innerHTML = "This didn't work";
        }
        
        return wrapper;
	},
</code></pre>
<pre><code>MMM-Test: This.data is set{"id":"E8RJkjfdcwgtyoPMjQ_Olg","alias":"four-barrel-coffee-san-francisco","name":"Four Barrel Coffee","image_url":"https://s3-media1.fl.yelpcdn.com/bphoto/-_Ks4eF8aZcm3GZgUf5Urg/o.jpg","is_closed":false,"url":"https://www.yelp.com/biz/four-barrel-coffee-san-francisco?adjust_creative=joufChkTQP-Ru-G_5cRrMA&amp;utm_campaign=yelp_api_v3&amp;utm_medium=api_v3_business_search&amp;utm_source=joufChkTQP-Ru-G_5cRrMA","review_count":2069,"categories":[{"alias":"coffee","title":"Coffee &amp; Tea"}],"rating":4,"coordinates":{"latitude":37.7670169511878,"longitude":-122.42184275},"transactions":[],"price":"$","location":{"address1":"375 Valencia St","address2":"","address3":"","city":"San Francisco","zip_code":"94103","country":"US","state":"CA","display_address":["375 Valencia St","San Francisco, CA 94103"]},"phone":"+14158964289","display_phone":"(415) 896-4289","distance":1452.8696502343696}
</code></pre>
<p dir="auto">How can I display name?</p>
<p dir="auto">I tried this.data[0].name or <a href="http://this.data.name" target="_blank" rel="noopener noreferrer nofollow ugc">this.data.name</a> but no luck</p>
]]></description><link>https://forum.magicmirror.builders/post/62708</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62708</guid><dc:creator><![CDATA[lilpkstud]]></dc:creator><pubDate>Tue, 15 Oct 2019 21:57:29 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Tue, 08 Oct 2019 23:25:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lilpkstud" aria-label="Profile: lilpkstud">@<bdi>lilpkstud</bdi></a><br />
Well, you can call any variable from your config/defaults using the reference <code>this.config.variable</code>.<br />
Or <code>this.config.requestToken</code> respectively.</p>
<p dir="auto">Something important to remember:<br />
Sometimes, e.g. when you use a callback function, note that the <code>this</code> reference may change (better: the context changes).<br />
Therefore you will often see something like this in the module codes early in a function:</p>
<pre><code>self = this
</code></pre>
<p dir="auto">And later on in the callback function</p>
<pre><code>self.config.requestToken
</code></pre>
<p dir="auto">Here, the “this” instance that is bound to its context, gives it’s properties to the global variable “self” that can then be used in any context (because it is global).</p>
<p dir="auto">For (much) more information check out <a href="https://scotch.io/@alZami/understanding-this-in-javascript" target="_blank" rel="noopener noreferrer nofollow ugc">https://scotch.io/@alZami/understanding-this-in-javascript</a></p>
]]></description><link>https://forum.magicmirror.builders/post/62417</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62417</guid><dc:creator><![CDATA[lavolp3]]></dc:creator><pubDate>Tue, 08 Oct 2019 23:25:35 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Tue, 08 Oct 2019 23:08:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lavolp3" aria-label="Profile: lavolp3">@<bdi>lavolp3</bdi></a> Thanks for the example I will look into it more</p>
<p dir="auto">However, is there a way to put my request token inside of the request header?</p>
]]></description><link>https://forum.magicmirror.builders/post/62416</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62416</guid><dc:creator><![CDATA[lilpkstud]]></dc:creator><pubDate>Tue, 08 Oct 2019 23:08:27 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Tue, 08 Oct 2019 23:02:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lilpkstud" aria-label="Profile: lilpkstud">@<bdi>lilpkstud</bdi></a> Taking MMM-Strava as an example:</p>
<p dir="auto">MMM-Strava.js (the main js file)</p>
<pre><code>Module.register("MMM-Strava", {
    // Default module config.
    defaults: {
        client_id: "",
        client_secret: "",
        period: "recent",   
        ...

</code></pre>
<p dir="auto">config.js:</p>
<pre><code>        //disabled: true,
        module: 'MMM-Strava',
        position: 'center',
        config: {
            client_id: "my_id",
            client_secret: "hereisthesecrethidden",

</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/62415</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62415</guid><dc:creator><![CDATA[lavolp3]]></dc:creator><pubDate>Tue, 08 Oct 2019 23:02:26 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Tue, 08 Oct 2019 22:59:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lilpkstud" aria-label="Profile: lilpkstud">@<bdi>lilpkstud</bdi></a> said in <a href="/post/62412">Creating Module with API Key/Secret</a>:</p>
<blockquote>
<p dir="auto">My main.js or into my node_helper.js?</p>
</blockquote>
<p dir="auto">Neither nor.<br />
You would create a string variable for both in the module defaults.<br />
THen in config.js which is only present on your device and not shared via github or else, you can overwrite the empty variable with your api_key and secret.<br />
There are loads of examples, a few coming to my mind are MMM-Strava or MMM-DarkSkyForecast (or nearly any other weather app.</p>
]]></description><link>https://forum.magicmirror.builders/post/62414</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62414</guid><dc:creator><![CDATA[lavolp3]]></dc:creator><pubDate>Tue, 08 Oct 2019 22:59:15 GMT</pubDate></item><item><title><![CDATA[Reply to Creating Module with API Key/Secret on Tue, 08 Oct 2019 22:54:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lilpkstud" aria-label="Profile: lilpkstud">@<bdi>lilpkstud</bdi></a> U put the default config in the module. If the helper needs it, the module sends it down</p>
<p dir="auto">See my Sample module.</p>
<p dir="auto"><a href="https://github.com/sdetweil/SampleModule" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/sdetweil/SampleModule</a></p>
]]></description><link>https://forum.magicmirror.builders/post/62413</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/62413</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Tue, 08 Oct 2019 22:54:17 GMT</pubDate></item></channel></rss>