Http get with a password?

hi,
is it possible to use http.get to access password protected file/ directory?
or does http.get work with ftp server?

i am trying to get some private data (not much about 10k of data) into my app and wondering what’s the best way to do it. best will be a combination of ease and at least some safety.

thanks in advance

I’ve never done this myself, but these may help.


Explains how this form of authentication works. In the context of AngularJS, you would need to add a header to your $http.get request. Using the example request (user ‘Aladdin’, password ‘open sesame’) from the Wikipedia page, you would do something like:

$http.get("/path/to/http-password-protected-resource", { 
    headers: { 
        "authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
    }
}).success(...

Of course you can set the authorization header with a variable.

I hope this helps or points you in the right direction.

Obviously if you hardcode the encrypted user/pass information in your app it is at risk of being discovered if someone looks inside the app package.

thanks for your help!
i will give this a shot. i will prompt the user for username and password, then use :
https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding

to encode them and send the result in the header.
that sounds like a good plan.