GithubHelp home page GithubHelp logo

Comments (3)

mbostock avatar mbostock commented on April 19, 2024 1

Here’s a little demo of basic authentication with Fetch:

https://beta.observablehq.com/@mbostock/fetch-with-basic-auth

So, all you need to do is prompt the user for their username and password, and then initialize the Authorization header accordingly.

from d3-fetch.

gaellafond avatar gaellafond commented on April 19, 2024 1

Thanks for the reply.

I was not aware of the new fetch method. I though I could use d3-fetch as a direct replacement for d3-request. I understand what I have done wrong now.

For those interested:

const d3request = require('d3-request');
...
d3request.text(url, function(error, data) { ... });

can be replaced with

const d3fetch = require('d3-fetch');
...
d3fetch(url, {credentials: 'same-origin'})
.then(function(data) { ... })
.catch(function(error) { ... });

from d3-fetch.

mbostock avatar mbostock commented on April 19, 2024

d3-fetch is a tiny wrapper on the Fetch API standard. If you want help using the Fetch API, please use Stack Overflow. If you think the Fetch standard needs to be changed, please reach out to the WHATWG (see the previous link for GitHub, IRC, Twitter, etc.) or your preferred browser vendor. If you want to continue using XHR, please feel free to continue using d3-request, either as part of D3 v4 or as a plugin for D3 v5. Thank you!

from d3-fetch.

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.