Meteor RESTful Authentication. Is it possible?

前端 未结 3 656
囚心锁ツ
囚心锁ツ 2021-02-09 16:26

I have searched around but cant find an a satisfactory answer to this question.

I have a meteor website where users login and create content. I also want to create a pho

3条回答
  •  醉酒成梦
    2021-02-09 17:17

    A few days ago I started on an app with similar requirements regarding authentication. I found that Differential's RESTstop2 recently, in version 0.6.0, upgraded their authentication support to support the newly added Bcrypt encryption in Meteor.

    You simply send username and password either as URL params or body like this:

    curl --data "password=testpassword&user=test" http://localhost:3000/api/login/
    

    and the server will return the following (if credentials are correct):

    { success: true, loginToken: "f2KpRW7KeN9aPmjSZ", userId: fbdpsNf4oHiX79vMJ }
    

    On each request you make to the server, include the loginToken and userId as headers.

    You should check it out:

    Docs: http://github.differential.io/reststop2/

    Github: https://github.com/Differential/reststop2

提交回复
热议问题