Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project Status? #4

Open
firrae opened this issue Aug 23, 2020 · 3 comments
Open

Project Status? #4

firrae opened this issue Aug 23, 2020 · 3 comments

Comments

@firrae
Copy link

firrae commented Aug 23, 2020

Hi there, just curious if this is still being maintained? The example site and such seem to be dead with a long period since the last commit.

@Shahar-Ben-Ezra
Copy link

Shahar-Ben-Ezra commented Aug 25, 2020

Hi,
There is an issue with apple-signin library with the Invalid Signature caused by the addition of new Apple Public Keys,
Apple recently added multiple public keys instead of the single public key that has been available since Apple Sign In was launched.
I suggest you to used this library https://github.com/alaborderie/node-apple-signin instead of Techofficer/node-apple-signin.

@paramsinghvc
Copy link

Facing the same issue!

@johndpope
Copy link

johndpope commented Nov 13, 2022

related - ananay/apple-auth#18

I haven't seen the code in this repo -
but I fixed it elsewhere using this
specifically

BROKEN. hard coding to let key = res.data.keys[0] // fails 1 in 7 goes.

const getApplePublicKey = async () => {
	let res = await axios.request({
		method: "GET",
		url: "https://appleid.apple.com/auth/keys",
	})
	let key = res.data.keys[0]
	const pubKey = new NodeRSA();
	pubKey.importKey({ n: Buffer.from(key.n, 'base64'), e: Buffer.from(key.e, 'base64') }, 'components-public');
	console.log('apple公钥')
	console.log(pubKey.exportKey(['public']))
	return pubKey.exportKey(['public']);
};

FIXED

const getAppleIDPublicKey = async (kid) => {
  let res = await axios.request({
    method: "GET",
    url: "https://appleid.apple.com/auth/keys",
  })
  // console.log("res:",res)
  const keys = res.data.keys;
  const key = keys.find(k => k.kid === kid);

  const pubKey = new NodeRSA();
  pubKey.importKey({ n: Buffer.from(key.n, 'base64'), e: Buffer.from(key.e, 'base64') }, 'components-public');
  return pubKey.exportKey(['public']);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants