Socket
Socket
Sign inDemoInstall

23andme

Package Overview
Dependencies
21
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    23andme

JavaScript wrapper for the 23andMe API.


Version published
Weekly downloads
13
increased by160%
Maintainers
1
Install size
504 kB
Created
Weekly downloads
 

Readme

Source

23andme NPM version

JavaScript wrapper for the 23andMe API.

Installation

Install the package with NPM:

$ npm install 23andme

Usage

Minimal example:

import API from "23andme";

let clientId = "fake_client_id";
let clientSecret = "fake_client_secret";
let redirectUri = "http://localhost:9000/receive_code";
let scope = ["ancestry"];
let api = new API(clientId, clientSecret, redirectUri, scope);

function receiveCode(code) {
  api.auth(code)
  .then(() => api.ancestry())
  .then(ancestry => console.log(ancestry))
  .catch(err => console.error(err));
}

As can be seen, the package exposes an API wrapper class that can be instantiated. This class has the following methods:

  • constructor(clientId, clientSecret, redirectUri, scope)
    • Creates an instance of the class.
  • auth(code)
    • Authenticates with the 23andMe API by exchanging an authorization code for an authorization token.
    • Returns a Promise of the authorization token.
    • Call this method first before you make any API requests!
  • user()
    • Retrieves data from the API's /user endpoint.
    • Returns a Promise of the endpoint's response data.
  • names()
    • Retrieves data from the API's /names endpoint.
    • Returns a Promise of the endpoint's response data.
  • haplogroups()
    • Retrieves data from the API's /haplogroups endpoint.
    • Returns a Promise of the endpoint's response data.
  • ancestry()
    • Retrieves data from the API's /ancestry endpoint.
    • Returns a Promise of the endpoint's response data.
  • familyMembers()
    • Retrieves data from the API's /family_members endpoint.
    • Returns a Promise of the endpoint's response data.
  • relatives()
    • Retrieves data from the API's /relatives endpoint.
    • Returns a Promise of the endpoint's response data.

And the following properties:

  • authUri
    • The URI to redirect the user's Web browser to in order for them to login to 23andMe and be granted an authorization code. (When 23andMe sends the authorization code to your server, pass it to the auth() method!)
  • baseUri
    • The base URI of the 23andMe API.
  • token
    • The authorization token granted when auth() was called.

Disclaimer

The package is not officially affiliated with 23andMe in any way. Use at own risk.

Keywords

FAQs

Last updated on 18 Apr 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc