Giter Club home page Giter Club logo

Comments (2)

adamhooper avatar adamhooper commented on August 11, 2024

After a long effort with workers, I found some browser bugs with JSONP and HTTP Basic Authentication that are impossible to work around:

  • When you enter a wrong username/password in Google Chrome, authentication will fail--and then Google will provide the correct username/password you entered in a previous browser session. This is clearly a bug: if you browse to the page itself, Chrome prompts for credentials. https://code.google.com/p/chromium/issues/detail?id=147627&thanks=147627&ts=1347302705 -- the outcome is that the user sees projects and can import them, but the wrong password is set so the resulting DocumentSet has 0 documents.
  • When you enter the correct username/password in Firefox, a prompt pops up over the main page asking you to save the username/password. This is confusing. I think it's prompting the user to remember the "username" and "password" fields for documentcloud.org, which is wrong. It may be prompting the user to remember the "documentcloud_email" and "documentcloud_password" fields for overviewproject.org, which would be okay.

Anyway, there is no workaround for Chrome: it will give false positives no matter how we create our requests.

The solution: XmlHttpRequest. We can set the "Authorization" header ourselves; if that fails, DocumentCloud returns a 403 error (not a 401), so Chrome won't even be tempted to exhibit its bug.

The problem with that solution is that DocumentCloud needs to be configured to accept XHR requests. That means it needs to respond to HTTP "OPTIONS" requests for certain API endpoints. I submitted a pull request: documentcloud/documentcloud#32

Believe it or not, this is less code than we'd otherwise need.

from overview-server.

adamhooper avatar adamhooper commented on August 11, 2024

This works.

from overview-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.