Join GitHub today
Extract service packages from accounts packages #1024
Facebook, Github, Google, Meetup, Twitter, and Weibo packages have been refactored out from the related accounts-* packages.
Existing Account functionality (loginWithTwitter etc) works the same, with the exception that Meteor.loginWithTwitter, Meteor.loginWith_ExternalService_, Meteor.loginWithPassword, Meteor.loginWithToken have all been renamed to Accounts.loginWithX
The ExternalService packages have all had two methods added - requestCredential on the client and retrieveCredential on the server. This allows a meteor app to ask the user to provide twitter credentials, and the app can then do with the credentials what it pleases. Retrieving the credentials is no longer tied to the accounts system as it was. I've created a demo app that implements this for Twitter and Facebook.
There are 3 new oauth packages - oauth, oauth1, and oauth2. These are a refactor of the accounts-oauth* packages, and have been refactored to be used independently of accounts.
There is a new service-configuration package which is simply refactoring the configuration collection (and related ConfigError) out from accounts-base.
I have updated the documentation to reflect the renaming of the existing methods. I haven't added documentation for the new methods, as I figure it might be worth having a few people review them before officially documenting.
requestCredential is a client method that opens the login form for the related service, and prompts the user to authorize the app. It takes two arguments - options and credentialRequestCompleteCallback. The credentialRequestCompleteCallback is called after the third party authorization flow is complete. It is called with one argument, which may be an Error, or a credentialToken. If it's a credentialToken, it can be passed to a Meteor Method, which in turn calls the service's retrieveCredential method.
retrieveCredential is a server method that takes a credentialToken, and returns either the user's credentials for the service, or an Error if one occurred.