http://login:password@mysite.com did not work on Android

2 posts, 0 answers
  1. Денис
    Денис avatar
    2 posts
    Member since:
    Jan 2015

    Posted 12 Mar 2015 Link to this post

    Hi

    I try connect to restricted area (htpasswd auth) of my site via

    $.ajax( {
                url: "http://login:password@my.site.com/restricted"
    })

    construction

    All works excellent in simulator but Android client get 401 response with same login and password

    Looks like missed permissions or something other stuff but I can't fugure it out

    Help please!
  2. Денис
    Денис avatar
    2 posts
    Member since:
    Jan 2015

    Posted 12 Mar 2015 in reply to Денис Link to this post

    Fixed!

    Add this to ajax options

        headers: {
                'Authorization': "Basic " + btoa(login+ ":" + password)
        },
Back to Top