Coder Social home page Coder Social logo

verify-apple-id-token's Introduction

Build Status Publish Status npm version codecov

Verify Apple idToken

  • Small utility which verifies the Apple idToken
  • You can use it on the backend side
  • Token verification is part of Apple sign-in process
  • The flow is
    • Client app (iOS or Android) will redirect user to the OAuth2 login screen
    • User will login
    • App will receive the tokens
    • App should send the idToken to the backend which will verify it
  • Verification steps implemented:
    • Verify the JWS E256 signature using the server’s public key
    • Verify the nonce for the authentication
    • Verify that the iss field contains https://appleid.apple.com
    • Verify that the aud field is the developer’s client_id
    • Verify that the time is earlier than the exp value of the token

Installation

npm install verify-apple-id-token

Usage

Typescript

import verifyAppleToken from 'verify-apple-id-token';

const jwtClaims = await verifyAppleToken({
    idToken: 'yourIdToken',
    clientId: 'yourAppleClientId',
    nonce: 'nonce', // optional
});

Javascript

const verifyAppleToken = require('verify-apple-id-token').default;

const jwtClaims = await verifyAppleToken({
    idToken: 'yourIdToken',
    clientId: 'yourAppleClientId',
    nonce: 'nonce', // optional
});

verify-apple-id-token's People

Contributors

dependabot[bot] avatar renovate-bot avatar stefanprokopdev 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.