title: Create an account through a REST api
body: <p>I'd like to create a <strong>secure</strong> API in <code>node.js</code> for my mobile app.
  Basically I would like users to be able to create their account through the app (with email and password), so I'm wondering what would be the right way. I imagine something like this:</p>
  
  <pre><code>curl -d '{"email":"hello@world", "password":"1234"}' -H "Content-Type: application/json" -X POST https://myapi/users
  </code></pre>
  
  <p>So server would reply with the new created user and oauth usual tokens in order to authenticate the next requests so:</p>
  
  <pre><code>{
     id: '1234455656',
     email: 'hello@world',
     auth_token: 'my_auth_token'
     refresh_token: 'my_refresh_token'
  }
  </code></pre>
  
  <p>It just doesn't feel like the best secure way to do it as anyone could create a user even without the app, and I'm wondering if this is how apps usually deal with this? Maybe there's even something better than express to do this well</p>