for apple SSO login i'm getting `failed to decode ...
# support-questions-legacy
u
for apple SSO login i'm getting
failed to decode PEM block containing private key
, anyone have thoughts? I have the .p8 key formated as a flat string like in the examples
r
Hey @_station_
Can i see how you are passing in the key?
u
using the go backend w/ go fiber
Copy code
{
// For iOS Apps
ClientType: serverConfig.APPLE_CLIENT_TYPE,
ClientID:   serverConfig.APPLE_CLIENT_ID,
AdditionalConfig: map[string]interface{}{
    "keyId":      serverConfig.APPLE_KEY_ID,
    "privateKey": serverConfig.APPLE_PRIVATE_KEY,
    "teamId":     serverConfig.APPLE_TEAM_ID,
},
Scope: []string{"name", "email"},
},
r
does your private key have
-----BEGIN PRIVATE KEY-----\n
at the start and
\n-----END PRIVATE KEY-----
at the end?
u
APPLE_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49ASDFBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----
looks like this
r
is there a new line char between
-----BEGIN PRIVATE KEY-----
and
\n
?
u
there is, I think just the formatting in discord is wonky
I was looking in the https://github.com/supertokens/supertokens-golang repo trying to see what is being used to parse the string. otherwise if that is all the formatting that is required then I'll doublecheck the envs that are being passed from my host
r
yea, that's all the formatting required. Im not sure off the top of my head why this error would come, but you can see the code in our repo here: https://github.com/supertokens/supertokens-golang/blob/master/recipe/thirdparty/providers/apple.go#L130C39-L130C55 If you find a bug, let us know please. It's a higher chance that the input is incorrect somehow.
u
thanks
it was my fault, the env key on the host was lightly diff than what the config was loading
r
Sounds good