npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@datafire/npr_identity

v3.0.0

Published

DataFire integration for NPR Identity Service

Downloads

6

Readme

@datafire/npr_identity

Client library for NPR Identity Service

Installation and Usage

npm install --save @datafire/npr_identity
let npr_identity = require('@datafire/npr_identity').create({
  access_token: "",
  refresh_token: "",
  client_id: "",
  client_secret: "",
  redirect_uri: ""
});

.then(data => {
  console.log(data);
});

Description

The entry point to user-specific information

Actions

oauthCallback

Exchange the code passed to your redirect URI for an access_token

npr_identity.oauthCallback({
  "code": ""
}, context)

Input

  • input object
    • code required string

Output

  • output object
    • access_token string
    • refresh_token string
    • token_type string
    • scope string
    • expiration string

oauthRefresh

Exchange a refresh_token for an access_token

npr_identity.oauthRefresh(null, context)

Input

This action has no parameters

Output

  • output object
    • access_token string
    • refresh_token string
    • token_type string
    • scope string
    • expiration string

postFollowing

After a successful call, this returns a User document with an updated list of affiliations.

npr_identity.postFollowing({
  "Authorization": "",
  "body": null
}, context)

Input

  • input object
    • Authorization required string: Your access token from the Authorization Service. Should start with Bearer, followed by a space, followed by the token.
    • body required Affiliation

Output

updateStations

Right now, only the primary station can be changed. Previously selected stations will not be deleted, but the new station will be moved to first in the array.

npr_identity.updateStations({
  "Authorization": ""
}, context)

Input

  • input object
    • Authorization required string: Your access token from the Authorization Service. Should start with Bearer, followed by a space, followed by the token.
    • body array
      • items integer

Output

getUser

After a successful login, the client should send a GET call approximately once an hour to refresh the user data.

npr_identity.getUser({
  "Authorization": ""
}, context)

Input

  • input object
    • Authorization required string: Your access token from the Authorization Service. Should start with Bearer, followed by a space, followed by the token.

Output

inheritFromTempUser

This can and should only be used by clients who have access to the temporary_user grant type. Third-party developers do not have access to this grant type by default, and will not need this endpoint.

npr_identity.inheritFromTempUser({
  "Authorization": "",
  "temp_user": 0
}, context)

Input

  • input object
    • Authorization required string: Your access token from the Authorization Service. Should start with Bearer, followed by a space, followed by the token.
    • temp_user required integer: The temporary user's ID before the user registered or logged in

Output

Definitions

AbstractCDocLink

  • AbstractCDocLink
    • href required string: The link to be followed
    • content-type required string: The MIME type of the response of this link

AbstractLink

  • AbstractLink object
    • href required string: The link to be followed

Affiliation

  • Affiliation object: A program (aggregation) that a given user has shown an affiliation with
    • daysSinceLastListen integer: The number of days since a user last listened to a story from this aggregation. Absent if user never listened to the aggregation.
    • following required boolean: Whether or not the user is following the aggregation. When changing affiliation status, the client is expected to toggle this value and then send the entire object back.
    • href required string: A link to more details about the program from the NPR Story API
    • id required string: A unique identifier for the aggregation (program)
    • notif_following array: The topic in Firebase Cloud Messaging to which the device should subscribe if it supports notifications and the user wants notifications about the podcasts they follow.
      • items string
    • notif_rated array: The topic in Firebase Cloud Messaging to which the device should subscribe if it supports notifications and the user wants notifications about the podcasts they have highly rated.
      • items string
    • rating number: The user's average rating for this affiliation on a scale of 0-1. Absent if user never listened to the aggregation.
    • title string: The title for the aggregation (program)

Algolia

  • Algolia object: Parameters for querying the Algolia Search SDK for content
    • apiKey required string: A search API key for this user

Cohort

  • Cohort object: An experimental grouping for User Experience A/B Testing
    • id required string: A short ID for this cohort; ignored on a PUT
    • name required string: A text string identifying the cohort, useful for metrics; ignored on a PUT
    • public string: For internal use only; represents the current configuration file being used by the Listening Service
    • test string: For internal use only; represents the test configuration file being used by the Listening Service

CollectionDocument

  • CollectionDocument object: Base Collection.Doc+JSON output
    • attributes required object
    • errors required array: A list of encountered errors, ignored on POST, PUT
      • items object
    • href required string: A URL representation of the resource; should generally be ignored by clients unless noted otherwise
    • items required array
      • items object
    • links required object
    • version required string: The version of the Collection.Doc+JSON spec being used

Error

  • Error object: A serialized version of any error encountered when processing this request
    • code required integer: The error code
    • debug string: Additional debug information if debug mode is turned on
    • text string: The error description

ErrorDocument

  • ErrorDocument: A Collection.doc+JSON representation of an error result from an API call
    • attributes required object
    • errors required array: A list of encountered errors, ignored on POST, PUT
      • items object
    • href required string: A URL representation of the resource; should generally be ignored by clients unless noted otherwise
    • items required array
      • items object
    • links required object
    • version required string: The version of the Collection.Doc+JSON spec being used
    • attributes object: Ignore; will be empty for errors
    • errors array: A list of encountered errors, ignored on POST, PUT
    • items array: Ignore; will be empty for errors
      • items object
    • links object: Ignore; will be empty for errors

Organization

  • Organization object: A station that a user has an affiliation with
    • call required string: Station call letters
    • city required string: A short description of the station's main market city
    • displayName required string: A short displayable text field for the end user, strictly text; ignored on PUT
    • donationUrl string: Station donation page URL
    • id required string: Some unique identifier for the organization for the user
    • logo string: Station logo image url
    • notif_org array: The topic in Firebase Cloud Messaging to which the device should subscribe if it supports notifications and the user wants notifications about their localized station.
      • items string
    • serviceId string: Some unique identifier for the user's organization's primary service, or null if the org has no services
    • smallLogo string: Station logo image url

UserData

  • UserData object: Object; see description of a user object below
    • affiliations array: Program(s) that the user has positively interacted with
    • algolia required array: Use this information to search Algolia for stories
    • cohort required Cohort
    • email string: The user's email address
    • firstName string: The user's first name
    • id required string: Some unique identifier for the user
    • lastName string: The user's last name
    • organizations required array: User's chosen NPR Member Station(s)
    • totalListeningTime string: Internal use only. User's total listening time across all platforms.

UserDocument

  • UserDocument
    • attributes required object
    • errors required array: A list of encountered errors, ignored on POST, PUT
      • items object
    • href required string: A URL representation of the resource; should generally be ignored by clients unless noted otherwise
    • items required array
      • items object
    • links required object
    • version required string: The version of the Collection.Doc+JSON spec being used
    • attributes UserData
    • items array: Not used, ignored on a PUT
      • items object
    • links object: A list of links, not used by the Identity Service; ignored on a PUT