clayallsopp / maglev

Faster, smoother iOS development
36 stars 7 forks source link

question: example of how to set authentication #10

Closed VGraupera closed 11 years ago

VGraupera commented 11 years ago

Hi,

How do you set authentication in Maglev::API.setup? I cant find an example and i've tried a few combinations without success.

In BW, it would be something like

BW::HTTP.get("http://mysite.com/resource", {credentials: {username: 'john', password: 'API'}}) do |response| p response.body.to_str # prints the response's body end

but I dont see how to pass these credentials into Maglev::API.setup.

Thanks.

clayallsopp commented 11 years ago

This isn't supported in Maglev right now. I know it is in @iwarshak's AFMotion branch (https://github.com/iwarshak/maglev/tree/afmotion) via AFMotion support, but nothing here yet.

trestrantham commented 11 years ago

Can't you just set the credentials in the default_url_options like so?

Maglev::API.default_url_options = { credentials: { username: "foo", password: "bar" } }
iwarshak commented 11 years ago

You could, but then your credentials are sent as url params, and not encrypted