Extract service packages from accounts packages #1024
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.