Apple client secret signing key pem format

I’m trying to setup Sign In With Apple. I’ve gone through the process on the apple side and generated the necessary info. I followed the guide here: https://auth0.com/docs/connections/apple-setup

I’m trying to add it to the Auth0 Apple config screen (social setup), but when I try to save the screen with the “Client Secret Signing Key” entered I receive an error “Error! options.app_secret must be in PEM format”. I used the provided node script to generate the key, and I’ve tried wrapping the result in things like -----BEGIN CERTIFICATE----- and -----BEGIN PRIVATE KEY----- but I get the same error.

I would appreciate any suggestions. Script below. Thanks

const jwt = require(“jsonwebtoken”);
const fs = require(“fs”);

const privateKey = fs.readFileSync(“…/keys/AuthKey_signInWithApple.p8”);
const token = jwt.sign({}, privateKey, {
algorithm: “ES256”,
expiresIn: “60 days”,
audience: “https://appleid.apple.com”,
issuer: “YGF36*****”,
subject: “com.myurl.webapp”,
keyid: “BJR79*****”
});
console.log(“The token is:”, token);

Even I am facing the same issue. Has any one found out the solution to this problem?

We’ve recently released a new article after Apple released Sign In With Apple. Have you had a chance to check that?

I’m having the same issue and I’ve tried the same steps as you @jbillinger .

I’ve followed the blog post that @konrad.sopala recommended but there’s no mention of how to generate/find the Client Secret Signing Key.

Does anyone from Auth0 have info on the format needed here or how to create the key?

You can get the Client Secret Signing Key from your app setup on apple’s developer site. Using the new documentation we were able to get sign-in with apple working well. It’s confusing…most things involving apple certs are, but I can assure you that it does work if you follow the docs.

1 Like

Thanks a lot for the feedback @jbillinger!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.