How i can create user on server

I use ONLY accounts-base package, i want create my own custom auth system. how i can create user on server? Accounts.createUser() NOT exists in server. And i not want use accounts-password package.

Please help me. I want to manually create users. manually create and delete tokens for them, manually transfer them tokens to the client, I want full control. How can I create a user on the server?

Meteor.users.insert() ? But then, the special fields needed by the accounts-base system are not created.

Unfortunately this isn’t super well documented.
The easiest way to understand is to look at the code and the comments in the code:

Check out how Login Handlers are defined

And how you can register your own login handler with Accounts.registerLoginHandler

And then have a look at the login handler registered by accounts-password

Then look at the implementation of Accounts.createUser

You’ll start to understand why createUser is provided by accounts-password, and why a replacement would need to define it’s own.

From there, you can create your own accounts implementation

1 Like

Any reason why you want to re-invent the wheel? I would seriously consider the security aspect of such endeavor, the account package has been developed / in production of many years now. with no known vulnerabilities.

Are you trying to integrate third party application? If so you could use DDP client.

Any reason why you want to re-invent the wheel?

  1. we allow entry only through Steam, and not a single working package is available for this.

  2. The administrator can enter the admin panel only by entering the code from sms. One field sms code;

  3. We automatically create a user for any new anonymous connection, and save the activity settings in it. If after this the person decides to log in via the steam, the steam account will become attached to this user and the user will cease to be anonymous.

  4. Admin can create moderators account and give them phones and passwords.

e.t.c.

Tell me at least one package that does this, or take back your words about the wheel =)

Thank you very much =), there are really no documentation for many things, but as I understand it, this is not a public api and not an api at all. These are private functions.

The question is, if I use private methods, is it likely that they will disappear or change in future versions of the meteor?

The only core Accounts API which you need to interface with is Accounts.registerLoginHandler and I believe this one is widely used enough that it won’t change

by this api, can i create this? :

  1. we allow entry only through Steam, and not a single working package is available for this.

  2. The administrator can enter the admin panel only by entering the code from sms. One field sms code

  3. We automatically create a user for any new anonymous connection, and save the activity settings in it. If after this the person decides to log in via the steam, the steam account will become attached to this user and the user will cease to be anonymous.

  4. Admin can create moderators account and give them phones and passwords.

My temporary solution:

# create user with custom fields
user = Accounts.users.insert({money: 200})

Meteor.methods

	'customLogin': ->
		# on user login, create and set new token to this user
		token = Accounts._generateStampedLoginToken()
		Accounts._insertLoginToken(user._id, token )
		# then send token code to client
		return token 

in client you can auth by call Meteor.loginWithToken(token)

then this connection will now be associated with this user