monaca / monaca-lib

npm package for handling Monaca cloud API and local debugging API
http://monaca.io
Other
14 stars 11 forks source link

No longer able to login #121

Closed hereiam133 closed 6 years ago

hereiam133 commented 7 years ago

With this latest release of the cli (2.5.0), the lib no longer allows logging in.

We have the following gulp task setup (and have tried adding a logout function 1st to clear whatever is in the mem)

gulp.task('monaca-login', (done) => {
     monaca.login(monacaEmail, monacaPassword).then(
        () => {
            done();
        },
        (error) => {
            console.log('monaca-login', error);
            if (error) throw error;
        }
    );
});

this results in the following issue

monaca-login { status: 'fail', code: 400, message: 'Your client is old version. Please upgrade to the latest version.' }

andipavllo commented 6 years ago

monaca-lib requires the clientType to be specified during its initialization. For example:

var Monaca = require('monaca-lib').Monaca,
   monaca = new Monaca({clientType: 'api'});

We haven't included it in the getting started guide because we didn't think many developers would have been interested in using it standalone but I guess it's time now.

hereiam133 commented 6 years ago

@andipavllo Thank you, that has solved the issue, it would be great to have that added to the readme!

andipavllo commented 6 years ago

@hereiam133 just did it. I suggest you to use clientType: 'lib' instead of api, we have enabled it just for this purpose. Sorry for the trouble!