meteor/meteor — pull request #762 by timhaines (2013-02-28 23:30:35+00:00)
Title: Allow twitter login without meteor user upsert and meteor login

Howdy,

I'd like to enable Twitter login and oauth credential retrieval, without creating meteor users or logging the user into meteor with a corresponding meteor user.

My use case is that I want an already signed in user to be able to authorize other twitter accounts for their use, and I'd like to have control about where those twitter credentials are stored (they're attached an organization in my case).

The pull request in its current state works, but I'm expecting you'll have some feedback and some changes you'd like me to make after you've reviewed it.

What it allows is **loginWithTwitter** to be called, with two new options:

* **skipUserUpsert** to prevent the Meteor user from being created
* **replacementCallbackForAfterPopupClosed** to replace the Meteor login with another callback

To use it, I have a coffeescript event handler like so:

```
'click button.get-twitter-credentials': ->
Meteor.loginWithTwitter
skipUserUpsert: true,
replacementCallbackForAfterPopupClosed: (state, callback) ->
console.log 'Signed in with Twitter! state is', state
Meteor.call 'logLoginResultForState', state
```

and the server method can then access the oauth credentials like this:

```
logLoginResultForState: (state) ->
result = Accounts.oauth._loginResultForState[state];
console.log 'service is', result[0]
console.log 'serviceData is', result[1]
console.log 'oauth Options are', result[2]

delete Accounts.oauth._loginResultForState[state]
```