Forbidden: forbidClientAccountCreation: false, Create account by end user with package useraccounts


#1

Hi

Does Anyone have an example How to let end users create an account? I always get forbidden

Thanks


#2

You mean create another different account from their own. Everyone creates a user when they sign up using the basic loginbuttons pattern. Meteor.users() is obviously special, so there is publishing the data and allow/deny stuff secret sauce in the accounts-ui package. The usual go is to make a server side method and call that from your client because really you don’t want the great unwashed creating users on the client. Think bad people doing it.


#3

Thank you, Do you maybe have some example code?

I really wonder why this is so hard for me… I just want to try the most simple solution. Use the useraccounts and use the semantic layout package. I followed the manual, and now I get forbidden…

https://themeteorchef.com/blog/managing-people-with-meteor/

So I think I miss something very simple? All the guides directly go deep.

thanks


#4

So basically my question is… how can I let users login with google and facebook (already working), but also let them create an account if they don’t want to use facebook or google?

thank you


#5

@hoser23331 I think you need to use the accounts-password package for that. When you add that package you will see an option to sign up/in using a normal form. Here some resources to checkout:

  1. Meteor Users and Accounts Guide: gives you a good feel of what Meteor accounts eco-system does.
  2. Meteor Accounts Docs: More in depth documentation of the Accounts package.
  3. Meteor Tutorial: A practical use of the accounts package; this actually shows you how to use a “normal” username and password form for creating accounts and signing in.
  4. Useraccounts with Semantic UI: Styles that default login/sign-up from with Semantic UI.

It would be a good idea to post the contents of your .meteor/packages file, so we can give you more specific directions.


#6

Hi,

Thank you. If you use useraccounts combined with accounts password i get “forbidden” when creating an account How to Enablement this?

Please see all my config here Forbidden: forbidClientAccountCreation: false, Create account by end user with package useraccounts

I used this boilerplate https://github.com/meteor-useraccounts/boilerplates/tree/master/semantic-ui-iron-router/lib

I just want to have Facebook, Google and account create working together. In the help i see that you can forbid client account creation, but nowhere is mentoined How to do iT in the correct way?

Thanks


#7

This is the best tutorial http://meteortips.com/second-meteor-tutorial/user-accounts/

But iT does Not use the useraccounts package. IT looks iT is easier to just build iT from scratch compared to using the useraccounts package combined with Semantic ui accounts


#8

Anybody already a solution for this?

The code below does also not work for me (I already loaded the file from the server and the client)

Just in case anyone else finds this issue and removing accounts-ui did not resolve the issue. Make sure to call Options.set(‘forbidClientAccountCreation’, false); in common code not client only code. I ran mine in client/admin/options.js and no result but moving the file to lib/options.js suddenly allowed me to create users locally again.


#9

Ok, I found the issue.

I already included some code for alanning:roles, (which I found somewhere) and apparently useraccounts doesn’t like it…

Accounts.onCreateUser(function (options, user) {
    user.profile = {};
    // create a empty array to avoid the Exception while invoking method 'adminCheckAdmin'
    user.emails = [];
    console.log('here');
    if (Meteor.users.find().count()===0) {
        user.roles = ['admin'];
    }

    return user;
});

#10

SO the solution was the
Options.set('forbidClientAccountCreation', false);
?
Or was it the roles setting? it looks like all that the role is doing, is setting an admin role to the first logged in user (which Orion does by default)


#11

Hi

I had to remove this part:

Accounts.onCreateUser(function (options, user) { user.profile = {}; // create a empty array to avoid the Exception while invoking method 'adm…

Verstuurd vanaf mijn iPhone