Ogadai / zwift-mobile-api

MIT License
120 stars 25 forks source link

Upgrade Error #21

Closed Murvi closed 6 years ago

Murvi commented 6 years ago

Hi

I have been using the zwift-mobile-api which has been working great but realised I have not upgraded code base for GDPR changes and so upgraded yesterday but I started to receive errors.

I rolled back the upgrade and then found that the error I was receiving came from getAccessToken.js and Profile.js but if I used the original version of these files all worked as before.

Thinking the error was being created from installed software versions I created a clean Raspberry Pi install and installed NPM and zwift-mobile-api but still got the same error.

Can you point me in correct direction if I have missed something from upgrade.

I used simple script to test from the read.me file:

var ZwiftAccount = require("zwift-mobile-api"); var account = new ZwiftAccount(user, password);

// Get profile for "me" account.getProfile().profile().then(p => { console.log(p); // JSON of rider profile (includes id property you can use below) });

Genererating this error:

nodejs ZwiftAccount.js (node:10708) UnhandledPromiseRejectionWarning: Error: Request failed with status code 403 at createError (/home/pi/node_modules/zwift-mobile-api/node_modules/axios/lib/core/createError.js:15:15) at settle (/home/pi/node_modules/zwift-mobile-api/node_modules/axios/lib/core/settle.js:18:12) at IncomingMessage.handleStreamEnd (/home/pi/node_modules/zwift-mobile-api/node_modules/axios/lib/adapters/http.js:186:11) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) (node:10708) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:10708) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Ogadai commented 6 years ago

Hi @Murvi

Apologies for not bringing better news...

The new Developer API that zwift-mobile-api connects to requires a special Developer account (username and password), and won't work with regular rider accounts like before.

Unfortunately, due to the way Developer accounts currently work (with a single screen for granting access to 3rd-party services), I can't see them giving out very many. Currently there are only three 3rd-party apps that use them (ZwiftPower, CVR and ZwiftGPS).

I hope that they'll improve this at some point, to give access to hobby developers, but I'm afraid I have no inside information about Zwift HQ's plans on this.

Actually, I should add a note to the ReadMe explaining all this...

Regards, Andy

Murvi commented 6 years ago

Hi Andy

Thanks for your reply, I had thought this might be the case as when I changed the user back to the mobile user all worked.

That’s a pity as I had created a MagicMirror2 module to display my Zwift data and was tidying up the code as I was thinking about uploading to GitHub for others to use and thought better update your code.

Do you know if they will shutdown Zwift_Mobile_Client user soon for personal use, as I still find seeing my Zwift data on the mirror very useful and motivational.

Thanks for updating as I was going to start developing another idea I had but will hold off for moment.

Murvi commented 6 years ago

Hi Andy

Thanks for the update to the read.me with the Zwift email address.

Please close issue.