jsforce/jsforce — pull request #30 by chexxor (2014-06-21 23:04:37+00:00)
Title: Reuse `Connection` object from `browser.init`

See below for code.

When I call the `browser.login` method, the `Connection` object created in by the `init` method isn't re-used. Because of this, it passes the `config` created in `init` to `new OAuth2`. In the `browser.init` method, this same object is passed to `new Connection`. The config objects for these two classes are not the same shape, so we shouldn't do this. This incompatibility broke my `login` call.

Thoughts? (Note: I didn't write tests or anything for this, but this patch works for me.)

jsforce.browser.init({
oauth2: {
loginUrl: loginUrl,
clientId: clientId,
clientSecret: clientSecret,
redirectUri: redirectUri
},
accessToken: accessToken,
sessionId: sessionId,
refreshToken: refreshToken,
proxyUrl: proxyUrl
});
// Later
jsforce.browser.login()