Reputation: 1246
I'm trying to implement the accounts-ui in a mobile angular-meteor app. I have all the dependencies installed, and I'm trying to setup the Accounts.ui.config with the following code:
import { Accounts } from 'meteor/accounts-base';
Accounts.ui.config({
passwordSignupFields: 'USERNAME_AND_EMAIL'
});
But when I try to run the app, I get the following error:
TypeError: Cannot read property 'config' of undefined
at meteorInstall.server.auth.js (server/auth.js:4:1)
at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
at server/publications.js:124:1
at /home/ubuntu/workspace/musiker/.meteor/local/build/programs/server/boot.js:297:10
at Array.forEach (native)
at Function._.each._.forEach (/home/ubuntu/.meteor/packages/meteor- tool/.1.4.0.hylsrj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
at /home/ubuntu/workspace/musiker/.meteor/local/build/programs/server/boot.js:133:5
I thought maybe I need to import accounts-ui for the page, but the docs clearly show importing the account-base. I also tried importing the accouns-ui and I still got the same error.
Thank!
-Erick
Upvotes: 0
Views: 5476
Reputation: 1
I have the same error. First I put the JS into lib/startup/accounts-config.js or lib/accounts-config.js ,it still has error. But it becomes effective when I put the JS into imports/startup/accounts-config.js. I don't know the reason.
Upvotes: 0
Reputation: 1128
Add accounts
package before using this.
Use this command in the project root to add the package
meteor add accounts-ui accounts-password
This should make your code work.
Upvotes: 3
Reputation: 2184
You need to add the config on client side code :
import { Accounts } from 'meteor/accounts-base';
Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY',
});
Have a look here for more details.
Upvotes: 1
Reputation: 2374
It looks like you are trying to execute Accounts.ui.config
on the server but this function is only available on the client.
Upvotes: 1
Reputation: 21836
It is Accounts.config.
Accounts.config({
passwordSignupFields: 'USERNAME_AND_EMAIL'
});
Upvotes: 0