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

apple-signin-verify-token

v0.1.4

Published

Verify new apple sign-in token in Node

Readme

About

A small package that helps you verify Apple SignIn token on the server. It uses Apple public keys to verify the token. Apple website guide. This package exists, because there isn't clear instructions from apple on how to do this.

This package uses jwks-rsa to retrieve RSA signing keys from Apple's JWKS (JSON Web Key Set) endpoint and generates a public key. Apple guide.
Then uses jsonwebtoken to verify your token with that public key.

This package exports only one method verify(token: string).

Methods

.verify(token)

Takes 1 string argument.
Returns a Promise

Usage

Install:

npm i apple-signin-verify-token

Use it in your node.js sever

const Verifier = require("apple-signin-verify-token");

const token = 'LONG_TOKEN'; // token that apple sign in provides.

Verififier.verify(token).then(response => {
  // see response format below.
}).catch(error => {
  console.log(error);
})

Response
Read the guide by Apple Authenticating Users with Sign in with Apple

{
  iss: 'https://appleid.apple.com',
  aud: 'YOUR_BUNDLE_ID',
  exp: 1587334349,
  iat: 1587333749,
  sub: '001393.6d621dadasdd04956bds129fa982ba.1517', // user's unique ID by apple
  c_hash: 'dZusyqBNIzmfd8Uv_cVKSw',
  email: '[email protected]', // user's email 
  email_verified: 'true',
  is_private_email: 'true',
  auth_time: 1587333749,
  nonce_supported: true
}

Example usage

Assuming you are using Express.js


const Verifier = require('apple-signin-verify-token');

...

// pass the token and unique identifier given by client.
app.post('/apple-login', async (req, res) => {
  try {
    const { identityToken, userID } = req.body;

    const credentials = await Verifier.verify(identityToken);
    const { email, iss, sub } = credentials;

    // make sure the token is issued by apple and comes from current user.
    if (iss === 'https://appleid.apple.com' && sub === userID) {
      // find or create the user by userID

      res.status(200).send(/* user info */);
    } else {
      throw new Error('Invalid token.');
    }
  } catch (err) {
    return res.status(401).send(err.message);
  }
});

You should go over Apple's explanations on Verifying a User

When would you get an error?

If the token is expired or it has been tempered with, Apple servers will reject it and you will get Could not verify token error message.