Anyone using Apple Sign In with Medplum in React N...
# support
a
Hi there, everyone! I hope you are all well. I've just created an app based on medplum that I'm wanting to release to iOS Mobile App Store -- but I am wondering if there are any examples of folks who have successfully integrated Apple Login for a Medplum App? Based on reviewing the Medplum docs and our codebase, I understand the basic flow: - External auth requires: authorize URL, token URL, userinfo URL, client ID/secret - Redirect URI must be: https://api.medplum.com/auth/external - The provider must accept the profile OIDC scope Current implementation pattern I found: // Check auth method const authMethod = await checkAuthMethod(email); if (authMethod.isExternal) { // Redirect to external provider } // For external auth flow medplum.signInWithExternalAuth( EXTERNAL_AUTHORIZE_URL, EXTERNAL_CLIENT_ID, EXTERNAL_REDIRECT_URI, { projectId: MEDPLUM_PROJECT_ID, clientId: MEDPLUM_CLIENT_ID, redirectUri: WEB_APP_REDIRECT_URI, } ); Specific questions for Apple Sign In: 1. Apple's OAuth endpoints - Has anyone configured these successfully? - Authorize: https://appleid.apple.com/auth/authorize - Token: https://appleid.apple.com/auth/token - UserInfo: Apple doesn't provide a standard userinfo endpoint - how do you handle this? 2. Configuration challenges - Apple requires JWT client authentication instead of client secret - how to configure this in Medplum? 3. FHIR mapping considerations - Apple only provides email on first authentication - How do you handle the "Hide My Email" feature with Patient resources? Would really appreciate any code examples, configuration snippets, or lessons learned -- or even if this is just not possible yet! 🙏
r
Apple Sign In integration with Medplum in React Native or Expo apps we believe is possible but I don't have any firsthand knowledge of people using it! Is this for patient auth?
a
Hi Reshma! Thanks for responding and hope you're doing well! 🙂 Yes, this is for patient auth -- so, I think it should be doable in theory, but Apple does Sign In a bit different than standard OAuth, so it is making it a bit complicated. But I'll keep chugging away on it for a little bit, and see what is possible.
r
I wonder if @felipefariasl or teammate knows?
f
Hey @albert_wong 👋 , out of curiosity, were you ever able to get this to work?
a
Hey @finnbergquist -- good question. So... I tried for a while, but kept running roadblocks. Mainly, I kept being told (by Claude) that the Medplum backend needs to support Apple ID as an external auth provider and that I would need API endpoints to validate Apple ID tokens, create/link patient accounts with Apple ID and handle Apple's unique user identifier system
I think without Medplum API endpoints to handle Apple somewhat unique (?) authentication tokens and account linking, the mobile app was not able to implement Apple Sign-In effectively. But let me see what a possible solution might be, in case you and/or Medplum are interested in adding Apple ID support.
f
ok gotcha, thank you for the info @albert_wong 🙏
a
No worries, my pleasure! Thanks for all your help! 🙂
Quick question: @finnbergquist @reshma @felipefariasl Not quite sure if this is is even doable, but wondering if this is on the roadmap perhaps, for medplum and if not , if there's anything I could do to support it coming to be? Like would folks be open to a PR on this? (Not quite sure how all that works, but willing to roll up my sleeves or even contribute to a modest feature bounty?) Let me know! 🙂
i
@albert_wong we always welcome PRs
r
Unfortunately, we don't have any PR bounty at this time
a
No worries, @rahul -- I was just thinking about putting a little of my own money into a pot that someone else could claim if they added the feature. (When I used to work on Drupal -- back in the day! -- community folks would offer little small bounties that other folks could claim, but no worries -- totally understand.) Appreciate all that you and what everyone at Medplum does!
I submitted a PR on this here: https://github.com/medplum/medplum/pull/7312 -- not quite sure if there's anything else I need to do. But let me know if there is! Thanks so much to everone for your dedication and care. 🙂
Just sending a friendly bump on this @Derrick @reshma @cody
r
haven't forgotten Albert! Thanks for this bump
a
Thanks so much @reshma -- appreciate all you and everyone does! 🙂
Just checking in on this @reshma -- perhaps I am not doing things correctly? If there's anything I can do to move this along, let me know! Thanks so much letting me know! 🙂
r
Still going! https://github.com/medplum/medplum/pull/7851 - this one has a lot of implications, so needs special care 🙏
a
Yes, of course! No worries. Thanks so much to you @reshma and the whole crew for all of your depth of care in tending to the community and safeguarding things for us all! 🙂
Hi @reshma @cody ! 👋 Just wanted to provide a quick update on the Apple Sign-In PR situation. It looks like there are two PRs open: - PR #7312 (my original from ajwwong/medplum:feature/apple-sign-in) - PR #7851 (from medplum/medplum:ajwwong-feature-apple-sign-in) PR #7851 has a branch tracking issue - it points to a branch in the upstream repo that I can't push to, so I couldn't fix the CI issues there. PR #7312 is the correct one and is now passing all the important checks (DCO, Security, UI Tests, Storybook). Would someone be able to: 1. Approve the 3 pending workflow runs on #7312 (required for fork PRs) 2. Close #7851 as a duplicate Happy to make any changes needed for the review. Thanks so much for all your work on this -- and happy holidays to you all! 🙏 https://github.com/medplum/medplum/pull/7312
157 Views