Using Yarn
yarn add node-mac-sign-in-with-apple
Using NPM
npm install node-mac-sign-in-with-apple
Add to main process
import { signInWithApple } from 'node-mac-sign-in-with-apple';
ipcMain.on('sign-in-with-apple', async () => {
const nativeWindow = mainWindow.getNativeWindowHandle();
const data = await signInWithApple(nativeWindow);
})
Note: Only on first login Apple returns email and user name, on other requests Apple returns only idToken
Add to entitlements.plist
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
The package is available as open source under the terms of the MIT License.