login() {
		return this._particle.loginAsClientOwner({}).then((res) => {
			this._logger.log('Authenticated with Particle');
			this._accessToken = res.body.access_token;
			// Reauthenticate before the token expires
			// There is res.body.expires_in property but
			// as setTimeout is using 32 bit int the maximum
			// we can set is 2147483647 (~24 days)
			const expiresIn = Math.min(this._defaultExpiresIn, res.body.expires_in);
			this._expirationTimer = setTimeout(
				this._reauthenticate.bind(this),
				expiresIn
			);

			return this._accessToken;
		});
	}
/**
	 * Login using the client credentials, store the access token
	 * and set up token refresh before it expires
	 *
	 * @returns {Promise} Login promise
	 */
Login using the client credentials, store the access token
and set up token refresh before it expires

@returns {Promise} Login promise
Login using the client credentials store the access token and set up token refresh before it expires @returns { Promise } Login promise
login() {
		return this._particle.loginAsClientOwner({}).then((res) => {
			this._logger.log('Authenticated with Particle');
			this._accessToken = res.body.access_token;
			const expiresIn = Math.min(this._defaultExpiresIn, res.body.expires_in);
			this._expirationTimer = setTimeout(
				this._reauthenticate.bind(this),
				expiresIn
			);
			return this._accessToken;
		});
	}
login ( ) { return this . _particle . loginAsClientOwner ( { } ) . then ( ( res ) => { this . _logger . log ( 'Authenticated with Particle' ) ; this . _accessToken = res . body . access_token ; const expiresIn = Math . min ( this . _defaultExpiresIn , res . body . expires_in ) ; this . _expirationTimer = setTimeout ( this . _reauthenticate . bind ( this ) , expiresIn ) ; return this . _accessToken ; } ) ; }
Login using the client credentials, store the access token
 and set up token refresh before it expires
Login using the client credentials store the access token and set up token refresh before it expires
// Reauthenticate before the token expires // There is res.body.expires_in property but // as setTimeout is using 32 bit int the maximum // we can set is 2147483647 (~24 days)