hey, we're trying to add apple as a third party pr...
# support-questions-legacy
e
hey, we're trying to add apple as a third party provider (since apple don't allow social login if you don't have apple as option) when we add apple as provider we get the famous
[object Object]
error, can't figure out why
r
Hey! Where is this error coming from? Frontend or backend?
And how have you added the provider?
e
Hey! 🙂
it's comming from the backend (api route)
r
RIght, and from which API call? The /signinup one?
e
(when adding Apple as provider, with the right keys we assume, it errors out)
get authorisation url
r
What input are you giving to that?
e
When I comment out apple, it just works (giving me feedback),
r
huh.. did you rebuild your app / clear cache?
e
yeah we did, trying to figure out how to json.stringify the error message
maybe wrong keys, not sure
we are recreating the keys again
r
hmm. Okay
e
we recreated all keys, weird
still [object Object]
r
same error message from postman?
e
postman gives back 500, html page
r
html page.. thats odd. We don't send any HTML reply
probably the default reply from the framework you are using
e
nextjs, guess so
guess the error isnt catch somewhere
r
can you catch that error in your framework and do
console.dir(error)
You can add a try catch around the whole middleware part in the auth API
and print the error there
e
we did
the error didnt come in the catch block
thats the weird part
Copy code
js
  try {
    await superTokensNextWrapper(
      async (next) => {
        await middleware()(req, res, next)
      },
      req,
      res,
    )
    if (!res.writableEnded) {
      res.status(404).send('Not found')
    }
  } catch (err) {
    console.dir(err)
ca
r
hmmm
Is the error happening when you call supertokens.init?
Cause if you give invalid apple keys, the supertokens.init will throw an error
e
guess it's comming from the init,
r
right yea. That means the keys provided to the apple config are not valid
e
Copy code
js

supertokens.init({
  ...backendConfig(),
})
export default async function superTokens(
  req: NextApiRequest & Request,
  res: NextApiResponse & Response,
) {
  console.log('hello?')
hello doesnt get consoled 😉 so we can assume its from the init hehe
right?
ye weird, we just recreated the keys 😮
r
Yea.. maybe add a try / catch around
Copy code
supertokens.init({
  ...backendConfig(),
})
And see the error message?
e
ah thought the err would appear in the other try/catch my bad
shop-web:dev: ThirdPartyError { shop-web:dev: type: 'BAD_INPUT_ERROR', shop-web:dev: message: 'error:0909006C:PEM routines:get_name:no start line', shop-web:dev: payload: undefined, shop-web:dev: errMagic: 'ndskajfasndlfkj435234krjdsa', shop-web:dev: fromRecipe: 'thirdparty' shop-web:dev: } shop-web:dev: hello? shop-web:dev: error - Error: Initialisation not done. Did you forget to call the SuperTokens.init function?
r
So this means the init did not completed -> error from apple most likelty
e
so most likely the keys
r
yes
e
will try to recreate it again 😦
r
try using the dev keys we give -> do you run into the same error?
If not, then it's 100% the keys issue. Else something else
e
i couldnt find the dev keys, the docs are changed right? 😉
r
it's there in the docs (quick setup > backend). But here they are:
Copy code
Apple({
                        clientId: "4398792-io.supertokens.example.service",
                        clientSecret: {
                            keyId: "7M48Y4RYDL",
                            privateKey:
                                "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
                            teamId: "YWQCXGJRJL",
                        },
                    }),
e
hehe, ok its the keys 😉
we're probably doing sometghing wrong, will figure it out
thanks!@
r
cool! happy to help.
e
ah, my misstake i forgot to add
/n
in the private key
in case someone else has this problem 😉 let them check the privateKey
r
right! cool!
5 Views