mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Include avatar and language in serviceData when user signs in to Twitter
This commit is contained in:
@@ -3,13 +3,22 @@
|
||||
Accounts.oauth.registerService('twitter', 1, function(oauthBinding) {
|
||||
var identity = oauthBinding.get('https://api.twitter.com/1.1/account/verify_credentials.json').data;
|
||||
|
||||
return {
|
||||
serviceData: {
|
||||
var serviceData = {
|
||||
id: identity.id_str,
|
||||
screenName: identity.screen_name,
|
||||
accessToken: oauthBinding.accessToken,
|
||||
accessTokenSecret: oauthBinding.accessTokenSecret
|
||||
},
|
||||
};
|
||||
|
||||
// include helpful fields from twitter
|
||||
// https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials
|
||||
var whitelisted = ['profile_image_url', 'profile_image_url_https', 'lang'];
|
||||
|
||||
var fields = _.pick(identity, whitelisted);
|
||||
_.extend(serviceData, fields);
|
||||
|
||||
return {
|
||||
serviceData: serviceData,
|
||||
options: {
|
||||
profile: {
|
||||
name: identity.name
|
||||
|
||||
Reference in New Issue
Block a user