GithubHelp home page GithubHelp logo

observable-client's Introduction

Observable Client

A set of tools to communicate with observablehq.com:

  • Offers a REST client that mimics both unauthenticated and authenticated client requests.
  • Provides non-interactive and interactive wrappers to authenticate against GitHub, with support for 2FA.

Install

npm install mootari/observable-client

Authentication

GitHub

Authentication against GitHub requires you to provide Observable's client ID. To obtain the ID follow these steps:

  1. Open a private window (or log out of GitHub)
  2. Visit observablehq.com.
  3. Click "Sign in" and select "Sign in with GitHub".
  4. From the URL you were redirected to copy the part after ?client_id=, up to (but excluding) the next &.

The client ID should be 20 characters long and only contain the characters 0-9 and a-f.

Example

const {RestClient, AuthGithubPrompt} = require('observable-client');

const client = new RestClient;
(async () => {
  await new AuthGithubPrompt(client, {
    clientId: '0123456789abcdef0123',
    loginName: 'username',
  }).authorize();

  console.log('authorized', (await client.get('/user')).body);
})();

Roadmap

  • Caching API for cookies
  • API wrapper for documents
  • API wrappers for collections and users
  • Export/import tools
  • WebSocket client for edits and comments

observable-client's People

Contributors

mootari avatar

Watchers

 avatar

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.