I searched around, but could not find a satisfactory answer to this question.
I have a meteorite website where users register and create content. I also want to create a phone application that can interact with the website, and I want users to log in to the phone application and access the same content on the website. Pretty normal.
I created a basic REST API for accessing collections using the HTTP.publish meteor HTTP.publish . It works without any user information (without authentication), but now I want to use the userId of the GET methods in the rules of the Meteor.allow collections to access the current user.
So, I'm currently struggling with telling a meteor on a REST request, a user ID, even with just testing. I thought I could get the Accounts._storedLoginToken valid user in the browser and use it to test with CURL. Sort of
curl -H "X-Auth-Token: asdklfjasldfjlsadkjf" -H "Content-Type: application/json" -d '{"name":"A Name","description":"Testing description"}' http://localhost:3000/api/places
I tried this, but without joy, I get 403, which is at least good.
My questions are as follows:
- Are the tokens created for the client specific (i.e., hashed with the host URL or something else)?
- Does bcrypt use the
X-Auth-Token method? If not what I am doing wrong in the curl command. - Is DDP the only way to create valid tokens, or can I make an API call that will create a token on the server, even just by passing simple text credentials?
eg /api/login?user=shane&pwd=qwerty => return token I can use curl in the request.
I am really stuck with this, so anything pointing me in the right direction will be appreciated. I also note that HTTP.publish has not yet created the input / output methods, so maybe this is not so simple.
source share