/passport-apple-example

Passport Strategy for Sign in with Apple Example

Primary LanguageJavaScript

 [Example] Sign in with Apple for Passport.js

Follow @ananayarora

This repository is a how-to-use example for my library – passport-apple

Check it out here:

https://github.com/ananay/passport-apple

https://npmjs.com/package/passport-apple

Live on https://passport-apple.ananay.dev

Configuring

Make sure you've followed the configuration guide here!

Setup your Apple Developer Account as follows:

https://github.com/ananay/apple-auth/blob/master/SETUP.md

Configure the parameters here:

passport.use(new AppleStrategy({
    clientID: "",
    teamID: "",
    callbackURL: "",
    keyID: "",
    privateKeyLocation: ""
}, function(accessToken, refreshToken, idToken, profile, cb) {
    // Here, check if the idToken.sub exists in your database!
    if (req.body && req.body.user) {
      // Register your user here!
      console.log(req.body.user);
    }
    cb(null, idToken);
}));

Also make sure you've placed your AuthKey file in the config folder as well!

Questions / Contributing

Feel free to open issues and pull requests. If you would like to be one of the core creators of this library, please reach out to me at i@ananayarora.com or message me on twitter @ananayarora!

Created with ❤️ by Ananay Arora