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

Pass authentication token and user ID as URL parameters #220

Closed pvmeijel closed 8 years ago

pvmeijel commented 8 years ago

I would like to be able to pass the authentication token and user id as URL parameters, rather than as headers.

kahmali commented 8 years ago

You need to write what I've poorly named a "partial auth function" that parses the URL parameters and add it to your API configuration. It'll look something like:

var Api.V1 = new Restivus({
  useDefaultAuth: true,
  version: 'v1'
  auth: {
    user: function () {
      return {
        userId: this.urlParams.userId,
        token: this.urlParams.token
      };
    }
  }
});

Restivus will then validate the userId and token you return (using the default auth). I'm going to close this issue, but feel free to continue the discussion or reopen it if you have any difficulty getting this to work. Thanks for the question!