I can't seem to get basic auth working with OMF at all,  has anyone 
achieved this?  I have got it working using just request and mocha but no 
luck with OMF

Here's the working request example and two OMF examples that do not work... 
any tips greatly appreciateed.  Thanks! John

var https = require('http');
var omf = require('omf');
var assert = require('assert');
var request = require('request');
var should = require('should')

/*
 Works but no OMF
 */
describe('using request, no omf', function () {
    it("get all recipes", function (done) {
        var requestoptions = {
            path: "/appdata/" + APP_KEY + "/recipes",
            auth: {
                user: APP_KEY,
                pass: MASTER_SECRET
            }
        };
        request.get("https://baas.kinvey.com";, requestoptions, function 
(error, response, body) {
            assert(error == null)
            assert(response.statusCode == 200);
            done()
        })
    })

});


/*
 OMF : Results in a 401
 */
omf("https://baas.kinvey.com";, function (client) {
    describe('with path in client.get', function () {
        var options = {
            auth: {
                username: APP_KEY,
                password: MASTER_SECRET
            }
        };
        client.get("/appdata/" + APP_KEY + "/recipes", options, function 
(res) {
            res.has.statusCode(200);//results in 401
        });
    });
});

/*
 OMF : Results in a 404
 */
omf("https://baas.kinvey.com";, function (client) {
    describe('with path in options', function () {
        var omfoptions = {
            path: "/appdata/" + APP_KEY + "/recipes",
            auth: {
                username: APP_KEY,
                password: MASTER_SECRET
            }
        };
        client.get(omfoptions, function (res) {
            res.has.statusCode(200);//results in 404
        });
    });
});



/*
 OMF : Works, no auth
 */
omf("https://baas.kinvey.com";, function (client) {
    describe('with simple handshake', function () {
        client.get("/", function (res) {
            res.has.statusCode(200);//results in 401
        });
    });
});

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to