Login with Apple id returns "invalid_request Invalid web redirect url."

Viewed 1008

I'm trying to integrate Login with Apple id in my NextJS project. For authentication, I chose package next-auth. So, in the documentation for next-auth, it requires the following data:

import Providers from `next-auth/providers`
...
providers: [
Providers.Apple({
    clientId: process.env.APPLE_ID,
    clientSecret: { 
    teamId: process.env.APPLE_TEAM_ID,
    privateKey: process.env.APPLE_PRIVATE_KEY,
    keyId: process.env.APPLE_KEY_ID,
    }
})
]
...

I used this link to create the credentials for my account.

For the clientId I used an identifier for my ServicesID, right now it looks like com.test.client. For the teamId I used a string that was in the right top corner. For the privateKey I used the key that I generated in my account and downloaded it. I removed the parts where it says -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- and made sure the key stays in one line. keyId I got from my account.

I store all the values in the .env variable. I double-checked and the problem is not with the .env variable.

When I try to log in with Apple id It redirects me to this error page:

The page that I get redirected to when I try to log in

Here's the list of my URLs from the ServicesID page:

Domains and Subdomains:

test.com

www.test.com

Return URLs

https://test.com

I guess the problem is with my redirect url, but I don't understand what is it.

0 Answers
Related