kahmali / meteor-restivus

REST APIs for the Best of Us! - A Meteor 0.9+ package for building REST APIs https://atmospherejs.com/nimble/restivus
MIT License
544 stars 116 forks source link

Getting Unauthorized while trying to login #228

Closed amardeep-deligence closed 8 years ago

amardeep-deligence commented 8 years ago

Hi, I was using meteor-restivus for creating RESTful API in my project. Im stucked in userlogin. I've gone through documentation again and again, but still not getting my code work properly. URL I am using is: http://localhost:4000/api/login/?password=user&email=user@test.com getting response:(POST request) { status: "error" message: "Unauthorized" }

getting response:(GET request) { status: "error" message: "API endpoint does not exist" }

code for API: var Api = new Restivus({ apiPath: 'api/', auth: { token: 'auth.apiKey', user: function () { return { userId: this.request.headers['user-id'], token: this.request.headers['login-token'] }; } }, prettyJson: true, useDefaultAuth: true, });

I must be missing something, Please take a look. Thankyou!

alur222 commented 7 years ago

@amardeep-deligence hi, were u able to resolve this issue? Im also having issues logging in to the API i am building with restivus. please help

amardeep-deligence commented 7 years ago

@skemb321 Hi, Below code was enough for user authentication var Api = new Restivus({ apiPath: 'api/', version: 'v1', useDefaultAuth: true });

alur222 commented 7 years ago

@amardeep-deligence i really wonder what's wrong with mine:

const Api = new Restivus({
  useDefaultAuth: true,
  prettyJson: true,
  version: 'v1',
});

I will try adding apiPath.

alur222 commented 7 years ago

hmmm I've add apiPath but still the same issue :thinking: