If usePopup is giving you problems, a workaround is to bypass the Apple JS SDK and open the pop-up manually. When I did this, clicking on "Continue" after the user verified their credentials redirected the pop-up to my redirect uri, regardless of whether or not the popup and redirect uri were on different subdomains.
Here's the sample code that gets called whenever a user clicks on my "Sign In With Apple" button:
Code Block const handleClick = () => { |
const oauthUrl = `https://appleid.apple.com/auth/authorize?response_type=code&` + |
`client_id=${CLIENT_ID}&scope=name+email&response_mode=form_post&` + |
`state=${STATE}&redirect_uri=${REDIRECT_URI}&nonce=${secureRandomString(32)}` |
const windowWidth = 450 |
const windowHeight = 600 |
const left = window.screen.width / 2 - windowWidth / 2 |
const top = window.screen.height / 2 - windowHeight / 2 |
|
window.open(oauthUrl, 'Apple Sign-In',`menubar=no,location=no,scrollbars=no,status=` + `no,width=${windowWidth},height=${windowHeight},top=${top},left=${left}`) |
} |