Get values username:password in my route
Hi, I used Rest api for create posts. in my curl I used "-u appid:tokenapp" I want get values of my appid and tokenapp in my route.
Router.route('/api/posts', function () { // I need the values of appid and tokenapp here befor to create posts });
Thanks
@Mahdidridi i'm not sure what that functionality has to do with this basic-auth package? please clarify
Hello
In my example of request I send appId:tokenApp I used Authentication Function .but i don't know how I get value of appId in my route.
This my curl example of request
$ curl http://localhost:3000/api/posts
-X POST
-u c2bd9214f7e4:aa720b89e57642d2b8d97f5cee477c0c
-H 'Accept: application/json'
Meteor.startup(function () { //Auth var basicAuth = new HttpBasicAuth(function(username, password) { var appid = username; var token = password; // I serach if appid and token exist in my Collection applications // if exist I return true }); basicAuth.protect(); }); Router.route "api/posts", -> req = @request res = @response // I need here get value appId before to return response, because I insert value of appId in my collection posts , {where: 'server'}
Thanks