Implement social sign in using OIDC: Apple
To integrate your Apple app account with multiple applications (Web, Mobile, or Desktop) or a single application, you can utilize the Apple OIDC Authentication Provider on the ArcXP platform.
If you are using our Arc XP Identity blocks, see ArcXP Identity Themes Blocks Configuration & Customization Deep Dive. We provide a prebuilt Theme Block that can be used to display the Apple Sign-In button and connect to the Authentication Provider. If you need to build this on your own, consider the explanation and code provided below.
Create Apple Sign In Button
After setting up, create an Apple Sign In button on your website for users to sign in with their Apple ID. Utilize our Identity SDKs to implement the Apple Sign In functionality.
export default AppleSignInButton = () => { return { <button onClick={async () => { await Identity.initiateOIDC(clientId, ['name', 'email'], true,true); }} > Sign in with Apple </button> }; };
Apple Sign In Redirect and Login
Once the user signs in with Apple and is redirected to the specified page under the Redirect URI configured in our Authentication Provider, they need to be logged in using ArcXP Identity. Below is an example code snippet for reference
export const AppleRedirectAndLogin = ({ location: { search }, history }) => { const { code, state } = qs.parse(search.slice(1)); useEffect(() => { const redirect = () => { Identity.signInWithOIDC(code, state).then(() => { history.push('/profile'); }); }; redirect(); }, [code, history, state]); return <h3>Redirecting...</h3>;};
You should now be setup to use Apple Sign On using the OIDC protocol.