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

yeah-oauth

v1.0.0

Published

This NPM package simplifies the implementation of the OAuth 2.0 flow for the **Yeah** music platform, providing an easy way to generate the authorization URL and exchange the authorization code for access and refresh tokens.

Downloads

2

Readme

Yeah OAuth Library

This NPM package simplifies the implementation of the OAuth 2.0 flow for the Yeah music platform, providing an easy way to generate the authorization URL and exchange the authorization code for access and refresh tokens.

Installation

To install the package, run the command:

npm install yeah-oauth

Setup

After installation, you can use the OAuthClient class to simplify the OAuth authentication process with the Yeah platform.

Dependencies

  • axios: For making HTTP requests.
  • dotenv: To load environment variables (in case you want to store sensitive information like client_id and client_secret in .env files).

Usage

Step 1: Generate the App ID and Secret

Before using the package, you need to access the Yeah platform to generate the clientId and clientSecret for your application. This can be done at:

Developers Yeah

After registering your app on the Yeah platform, you'll receive the clientId and clientSecret, which are necessary for OAuth authentication.

Step 2: Initialize the OAuth Client

Create an instance of the OAuthClient class, passing the clientId, clientSecret, redirectUri, and the OAuth server URL.

const OAuthClient = require("yeah-oauth");

const CLIENT_ID = "your-client-id";
const CLIENT_SECRET = "your-client-secret";
const REDIRECT_URI = "http://localhost:4000/callback";

// Instantiate the OAuth client
const oauth = new OAuthClient(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI);

Step 3: Generate the Authorization URL

Use the getAuthUrl method to generate the authorization URL where the user will be redirected to log in.

const authUrl = oauth.getAuthUrl();
console.log(`Visit this URL to log in: ${authUrl}`);

Step 4: Receive the Authorization Code

After logging in, the user will be redirected to the redirectUri you provided, with an authorization code in the URL.

Example of a redirect URL:

http://localhost:4000/callback?code=authorization-code

Step 5: Exchange the Code for Tokens

After receiving the authorization code, you can use it to exchange for an access token and refresh token with the exchangeCodeForToken method.

const authorizationCode = "authorization-code-received-in-url";  // This code comes in the callback URL

// Exchange the code for tokens
oauth.exchangeCodeForToken(authorizationCode)
  .then((tokens) => {
    console.log("Access Token:", tokens.accessToken);
    console.log("Refresh Token:", tokens.refreshToken);
  })
  .catch((error) => {
    console.error("Error exchanging code for token:", error.message);
  });

API

OAuthClient

new OAuthClient(clientId, clientSecret, redirectUri)

  • clientId (String): The client_id provided by the OAuth server.
  • clientSecret (String): The client_secret provided by the OAuth server.
  • redirectUri (String): The URL where the OAuth server will redirect the user after login.

oauthClient.getAuthUrl()

Generates the authorization URL for the user to log in.

  • Return: An authorization URL.

oauthClient.exchangeCodeForToken(code)

Exchanges the authorization code for an access token and refresh token.

  • code (String): The authorization code received in the redirect URL.
  • Return: A promise that resolves with an object containing the accessToken and refreshToken.

License

MIT