Read the statement by Michael Teeuw here.
MMM-Strava
-
@hattlegr You need to create an application in your strava account to use this module. Have you done that?
- Go to www.strava.com/settings/api
- Create an application. As far as I understand the only really important value is the callback domain. I GUESS (!!) this would need to be http://localhost OR the hostname (or IP) of your magicmirror, something like http://magicmirror
- Then you get a client secret and access token, which you need for the further procedure.
-
@lavolp3 said in MMM-Strava:
@hattlegr You need to create an application in your strava account to use this module. Have you done that?
- Go to www.strava.com/settings/api
- Create an application. As far as I understand the only really important value is the callback domain. I GUESS (!!) this would need to be http://localhost OR the hostname (or IP) of your magicmirror, something like http://magicmirror
- Then you get a client secret and access token, which you need for the further procedure.
The easiest way to authorise the module is
-
On the My API Application page update the application by entering
localhost
as the callback domain. -
Once the Strava API application is updated, copy the
client id
andclient secret
from the same page, then use these to update the module configuration in theconfig.js
file and restart the Magic Mirror. -
Finally, on the Pi itself, browse to http://localhost:8080/MMM-Strava/auth/ and follow the steps.
If it helps, here are the settings I’ve been using to test the module:
-
@ianperrin The description above is very good and I have successfully got through this process.
I have added my new Client ID and Client-secret to the config file.
When I run my magicmirror I am asked to follow link to strava/auth.
I am able to select the module and click the authorize button. This brings me to an the authorize page with the three check boxes as described, when I click on the authorize button it brings me to the Stava login page. I am able to login, but the screen takes me to my dashboard page. with no home / back / close buttons. (it replaces the MM page). So I can’t get out of this stage.Out of interest, I tried opening a browser using localhost:8080 once MM is running and get the same screen. When I click on the authorize button in the browser environment the process works fine and I am eventually taken back to the MM page and the strava data is working. However, when I shut down and star again the authorization is forgotten.
-
@hattlegr okay so we’re making progress. What is the output in the log file or the debug console in the browser? Once you’ve authorised the module, was a
tokens.json
file created in the MMM-Strava module folder? -
@ianperrin No, there is no file called tokens.json
-
@hattlegr how about the logs or debug console?
-
@ianperrin Sorry, I can’t find any logs or sure what a debug console is.
-
@hattlegr okay, so the Magic Mirror creates logs in two places.
-
On the Pi itself. If you use
pm2
to start your mirror, these can be viewed by runningpm2 logs mm
-
In the browser console. These can be viewed in the browser’s Developer Tools (usually activated by CTRL-SHIFT-i).
Let us know what you find.
-
-
@ianperrin Here is the log after installing --production.
0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', '--production' ] 2 info using npm@5.6.0 3 info using node@v9.11.2 4 verbose npm-session 72bb8575f86ed6c8 5 silly install runPreinstallTopLevelLifecycles 6 silly preinstall MMM-Strava@2.0.0-BETA 7 info lifecycle MMM-Strava@2.0.0-BETA~preinstall: MMM-Strava@2.0.0-BETA 8 silly install loadCurrentTree 9 silly install readLocalPackageData 10 silly install loadIdealTree 11 silly install cloneCurrentTreeToIdealTree 12 silly install loadShrinkwrap 13 silly saveTree MMM-Strava@2.0.0-BETA 14 verbose stack SyntaxError: Unexpected token < in JSON at position 9216 14 verbose stack at JSON.parse (<anonymous>) 14 verbose stack at module.exports (/usr/lib/node_modules/npm/lib/utils/parse-json.js:3:15) 14 verbose stack at BB.join (/usr/lib/node_modules/npm/lib/install/read-shrinkwrap.js:31:20) 14 verbose stack at tryCatcher (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) 14 verbose stack at Holder$3._callFunction (eval at generateHolderClass (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:92:16), <anonymous>:14:44) 14 verbose stack at Holder$3.checkFulfillment (eval at generateHolderClass (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:92:16), <anonymous>:29:30) 14 verbose stack at Promise.eval (eval at thenCallback (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:14:16), <anonymous>:6:20) 14 verbose stack at Promise._settlePromise (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:566:21) 14 verbose stack at Promise._settlePromise0 (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10) 14 verbose stack at Promise._settlePromises (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18) 14 verbose stack at Promise._fulfill (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18) 14 verbose stack at Promise._settlePromise (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:582:21) 14 verbose stack at Promise._settlePromise0 (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10) 14 verbose stack at Promise._settlePromises (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18) 14 verbose stack at Promise._fulfill (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18) 14 verbose stack at /usr/lib/node_modules/npm/node_modules/bluebird/js/release/nodeback.js:42:21 15 verbose cwd /home/pi/MagicMirror/modules/mmm-strava 16 verbose Linux 4.9.80-v7+ 17 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--production" 18 verbose node v9.11.2 19 verbose npm v5.6.0 20 error Unexpected token < in JSON at position 9216 21 verbose exit [ 1, true ]
-
@hattlegr Note the error on line 20 related to a token which could be a possible reason MM does not remember the authorization.