Meteor RESTful Authentication. Is it possible?

前端 未结 3 650
囚心锁ツ
囚心锁ツ 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:26

    Another option (besides RESTstop2 mentioned in other answer), you can use stand-alone api-password package from Atmosphere, which does exactly what you need: authenticate REST calls on the server side. It supports Meteor 0.8.2 (with bcrypt) as well.

    Example for the server side

      try {
        if (ApiPassword.isPasswordValid(username, password)) {
          console.log('password is valid for this user');
        } else {
          console.log('password is not valid');
        }
    
      } catch (exc) {
          console.log(exc.message);
          // possible causes: 'User is not found', 'User has no password set'
      }
    

提交回复
热议问题