I cannot use third-party oAuth because `Accounts.loginServiceConfiguration` is undefined


I am trying to set up my app so users can login with their github accounts.

I can’t find any docs within the meteor.com ecosystem on this, so I am trying to follow various tutorials I have found here and there. This one popped up: https://www.youtube.com/watch?v=-CTSGdQOYYg and is a clear walk-through of how to set up logging in with Github.

However, I have run into a problem. The tutorial directs me to put the following code in server/config.js:

	service: "github"

	service: "github",
	clientId: "903d1753ce7f9e229344",
	secret: "9060dea98ae8ba59683d9090e80c4c3a6b91caae",

(don’t worry - I changed the ID and secret)

After I do this, however, my app crashes with the error: “TypeError: Cannot call method ‘remove’ of undefined”

I tried manually adding accounts-base and service-configuration packages, but I still get the same error.

What gives?


I found this, which seems like it could be helpful: https://github.com/meteor-useraccounts/core/issues/503

The gist of it is:

Deprecate Accounts.loginServiceConfiguration in favor of ServiceConfiguration.configurations, exported by the service-configuration package. Accounts.loginServiceConfiguration is maintained for backwards-compatibility, but it is defined in a Meteor.startup block and so cannot be used from top-level code.

So I am now trying this:

	service: "github"

	service: "github",
	clientId: "903d1753ce7f9e229344",
	secret: "9060dea98ae8ba59683d9090e80c4c3a6b91caae",

which results in: “ReferenceError: ServiceConfiguration is not defined”


I was never able to resolve this. What I did instead was clone this app, which already has github login working correctly: https://github.com/nobutakaoshiro/meteor-accounts-github-example Then I ported my app carefully over into this app, making sure not to tip over the github login along the way.


I feel like I’m stating the obvious, so please don’t be offended, but have you considered:

meteor add accounts-github


Yeah, I’ve definitely done that :wink:


I’ve always just started the app and gone to the login. It will show unconfigured orange button. Click that and it asks for the appropriate oAuth information and links etc. If you clone the app, you will have to reconfigure the oAuth. A meteor reset might resolve the issue. Be sure to backup any data first though. Each app has to have it’s own oAuth data from whatever login you’re using. i.e. Facebook, GitHub, etc.


does your db have the meteor_accounts_loginServiceConfiguration collection? if not, it may be that adding the service-configuration package didn’t work properly.


Use ServiceConfiguration.configurations.insert({}) instead.


So I’m having the same issue with both Google and Facebook configuration buttons, gettting an exception from the tracker recompute function.

Meteor 1.6
using accounts-ui, accounts-password, accounts-google, accounts-facebook, service-configuration.

I’ve uninstalled and reinstalled service-configuration.

meteor_accounts_loginServiceConfiguration exists in database…

Does anyone official have anything to say?

These are core packages are they not, and are supposed to work out of the box? The guide, doesn’t even hint at any issues which might crop up here.

Exception from Tracker recompute function:
meteor.js?hash=cbcc712d51de4298c275e8dcf25c66c29914f19a:992 Error: Expected template or null, found: undefined


What’s the output of meteor list?


accounts-facebook 1.3.0 Login service for Facebook accounts
accounts-google 1.3.0 Login service for Google accounts
accounts-password 1.5.0 Password support for accounts
accounts-ui 1.2.0 Simple templates to add login widgets to an app
alanning:roles 1.2.16 Authorization package for Meteor
aldeed:collection2-core 1.2.0* Core package for aldeed:collection2
blaze-html-templates 1.1.2 Compile HTML templates into reactive UI with Meteor Blaze
brentjanderson:buzz 1.1.10 The fantastic Buzz javascript sound library repackaged for Meteor
check 1.2.5 Check whether a value matches a pattern
chriswessels:back-behaviour 1.0.1 A pattern for defining and triggering in-app back button behaviour
chriswessels:slideout 0.1.12 A touch slideout navigation menu for your mobile web apps
cordova:cc.fovea.cordova.purchase 7.0.2
cordova:cordova-plugin-inappbrowser 1.3.0
cordova:cordova-plugin-tts 0.2.3
dburles:collection-helpers 1.1.0 Transform your collections with helpers that you define
dynamic-import 0.2.1 Runtime support for Meteor 1.5 dynamic import(…) syntax
ecmascript 0.9.0 Compiler plugin that supports ES2015+ in all .js files
email 1.2.3 Send email messages
es5-shim 4.6.15 Shims and polyfills to improve ECMAScript 5 support
fastclick 1.0.13 Faster touch events on mobile
fortawesome:fontawesome 4.7.0 Font Awesome (official): 500+ scalable vector icons, customizable via CSS, Retina friendly
http 1.3.0 Make HTTP calls to remote servers
jquery 1.11.10 Manipulate the DOM using CSS selectors
kadira:blaze-layout 2.3.0 Layout Manager for Blaze (works well with FlowRouter)
kadira:flow-router 2.12.1 Carefully Designed Client Side Router for Meteor
meteor-base 1.2.0 Packages that every Meteor app needs
mobile-experience 1.0.5 Packages for a great mobile user experience
mobile-status-bar 1.0.14 Good defaults for the mobile status bar
momentjs:moment 2.19.2 Moment.js (official): parse, validate, manipulate, and display dates - official Meteor packaging
mongo 1.3.0 Adaptor for using MongoDB and Minimongo over DDP
okgrow:analytics 1.0.9* Complete Google Analytics, Mixpanel, KISSmetrics (and more) integration for Meteor
okland:camera-ui-robs-local 0.0.2+ Take photos with UI one function call on desktop and mobile. Choose between camera to photoLibrary.
percolate:synced-cron 1.3.2 Allows you to define and run scheduled jobs across multiple servers.
reactive-dict 1.2.0 Reactive dictionary
reactive-var 1.0.11 Reactive variable
robsw:mediaquery-bootstrap-3 1.0.1 Media query template helpers and session variables with bootstrap 3 brakepoints
sach:flow-db-admin 1.1.5 Meteor Database Admin package for use with Flow Router
service-configuration 1.0.11 Manage the configuration for third-party services
session 1.1.7 Session variable
standard-minifier-css 1.3.5 Standard css minifier used with Meteor apps by default.
standard-minifier-js 2.2.3 Standard javascript minifiers used with Meteor apps by default.
themeteorchef:bert 2.1.3 A client side, multi-style alerts system for Meteor.
tomwasd:flow-router-autoscroll 0.0.2 Fixes page position after changing pages using Flow Router
tracker 1.1.3 Dependency tracker to allow reactive callbacks
twbs:bootstrap 3.3.6 The most popular front-end framework for developing responsive, mobile first projects on the web.
udondan:slick 1.3.11_1 the last carousel you’ll ever need
underscore 1.0.10 Collection of small helpers: _.map, _.each, …
useraccounts:bootstrap 1.14.2 Accounts Templates styled for Twitter Bootstrap.
webtempest:animate 0.1.9 Easily perform CSS animations and transitions in Meteor
zimme:active-route 2.3.2 Active route helpers


It looks like you’re missing the facebook-config-ui and google-config-ui packages. Try

meteor add facebook-config-ui google-config-ui


thanks will try that


Yeah that worked alright… odd that these aren’t auto dependencies. Thanks again!


They’re for Blaze, so if you’d been using React, you likely wouldn’t want them automatically included.


Ah yes makes sense… spent WAY too long on this issue, is all.