Skip to content

docs: Improve Apple Sign-In setup with missing steps and troubleshooting#473

Open
Zfinix wants to merge 5 commits into
mainfrom
chore/update-sign-in-with-apple-docs
Open

docs: Improve Apple Sign-In setup with missing steps and troubleshooting#473
Zfinix wants to merge 5 commits into
mainfrom
chore/update-sign-in-with-apple-docs

Conversation

@Zfinix
Copy link
Copy Markdown
Contributor

@Zfinix Zfinix commented Apr 29, 2026

Summary

  • Added missing Apple JS SDK script tag for Web setup
  • Added --dart-define instructions for Web/Android client configuration
  • Added troubleshooting entries for missing JS SDK and macOS sandbox conflict
  • Organized troubleshooting checklist by category (Portal / Server / Client)
  • Consolidated 3 back-to-back admonitions into 1 tip
  • Fixed broken link and removed $ prefix from bash commands

Test plan

  • Followed every step from a fresh serverpod create project
  • Verified Apple Sign-In on Safari (Web) and macOS native
  • Confirmed each new troubleshooting entry matches a real failure mode

@Zfinix Zfinix requested a review from Swiftaxe April 29, 2026 10:38
Comment thread docs/06-concepts/11-authentication/04-providers/04-apple/02-customizations.md Outdated
Comment thread docs/06-concepts/11-authentication/04-providers/04-apple/02-customizations.md Outdated
Comment thread docs/06-concepts/11-authentication/04-providers/04-apple/02-customizations.md Outdated
Comment thread docs/06-concepts/11-authentication/04-providers/04-apple/02-customizations.md Outdated
Copy link
Copy Markdown
Contributor

@Swiftaxe Swiftaxe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some things to improve above. Will continue review later.

@Zfinix Zfinix force-pushed the chore/update-sign-in-with-apple-docs branch from 7b94a3d to 132800b Compare May 4, 2026 16:48
@Zfinix Zfinix force-pushed the chore/update-sign-in-with-apple-docs branch from 910cc7e to 12648da Compare May 4, 2026 16:54
@Zfinix Zfinix requested a review from Swiftaxe May 5, 2026 08:20
The `webAuthenticationCallbackRoutePath` must match the **Return URL** you registered on your Service ID. The `revokedNotificationRoutePath` is called by Apple when a user revokes access from their Apple ID settings.

:::tip
If you need more control over how the credentials are loaded, you can use `AppleIdpConfig(...)` with manual `pod.getPassword()` calls instead. See the [customizations](./customizations) page for details.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tip has slipped down to the web routes section. It belongs under "Add the Apple identity provider".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the tip up under "Add the Apple identity provider" right after the AppleIdpConfigFromPasswords() example, where it actually applies.

…omization options, and troubleshooting details
### Add the Apple identity provider

Your server's `server.dart` file (e.g., `my_project_server/lib/server.dart`) should already contain a `pod.initializeAuthServices()` call if your project was created with the Serverpod project template (`serverpod create`). If it's not there, verify that `serverpod_auth_idp_server` is in your server's `pubspec.yaml` and see [Setup](../../setup) to configure the auth module and JWT settings.
In your server project directory, add the auth IDP server package:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under prerequisites we expect this to be installed. Now we add it. Is this in case they skipped the prerequisites? Please explain.

Copy link
Copy Markdown
Contributor Author

@Zfinix Zfinix May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Reframed the step as a fallback for users on upgraded projects that don't have it yet, instead of presenting it as required.

```

Add the Apple import and `AppleIdpConfigFromPasswords()` to the existing `identityProviderBuilders` list:
`AppleIdpConfigFromPasswords()` reads the eight `apple*` keys from `config/passwords.yaml` (or the corresponding `SERVERPOD_PASSWORD_` environment variables), so you do not have to wire up each credential manually. In your server's `server.dart`, import it and add it to the existing `identityProviderBuilders` list on `pod.initializeAuthServices()`:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit confusing to lead with an explanation of the FromPasswords function, before it gets introduced. (AppleIdpConfigFromPasswords() reads the eight apple* keys from...)

We could let this paragraph only instruct the user to add the import and the FromPasswords, then comes the code sample and then we explain the FromPasswords.

Move the explanation sentence to after the code example and rephrase this paragraph.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restructured: now the paragraph just tells the reader to add the import + provider, then the code block, then a short sentence explaining what AppleIdpConfigFromPasswords() does. Reads in the right order now.


Before you start, make sure you have:

- A Flutter project created with `serverpod create` (so the auth module and project template are in place).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true for most users, but not if you created the project with a an older framework version (<3.4?)
A user might not now what the auth module and project templates means. They should be able to quickly check off that they fulfill the prerequisites. And what to do if they don't (ie missing the new auth module).

The same goes for all providers.

Copy link
Copy Markdown
Contributor Author

@Zfinix Zfinix May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Updated the prerequisite to call this out explicitly: new projects (Serverpod 3.4+) get the auth module via serverpod create, and older projects are pointed at the auth module setup guide first. Will mirror this on the other providers.

In your server project directory, add the auth IDP server package:

```bash
dart pub add serverpod_auth_idp_server
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do they need to do this if they fulfilled the prerequisites above? (ie have the auth module installed)

Copy link
Copy Markdown
Contributor Author

@Zfinix Zfinix May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded the step as a fallback for upgraded projects rather than a required install.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better now. However, a user having an old project still has to follow the full guide to install the auth module, right?

Is it better to refer to the full setup guide instead?
We do that under prerequisites, but if they rushed past it, this is good place to remind them.

In your Flutter app's directory, add the auth IDP Flutter package:

```bash
flutter pub add serverpod_auth_idp_flutter
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be installed if prerequisites are met, right?

Copy link
Copy Markdown
Contributor Author

@Zfinix Zfinix May 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction on my earlier reply, you were right. Verified that serverpod create adds serverpod_auth_idp_flutter to the Flutter pubspec by default. Reframed the flutter pub add line as a fallback ("if your app doesn't have this, e.g. you're upgrading an older project, add it") instead of a required step.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this step doesn´t cover the whole setup for the client, we should refer to the auth module setup page instead, as noted in the server section as well.


### Set production credentials

Switch from the `development:` values you used during setup to production ones. Pick the path that matches your deployment:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The normal use case is not to "Switch" credentials, right? You want to add the production ones so they are in use when running in production, and dev credentials will still be used in development. Rephrase this so it's clear for new backend devs to not replace the dev credentials.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote the section. It now leads with "production runs out of the production: section, separate from development:" so it's clear that adding production credentials does not replace dev ones. Both stay and Serverpod picks the right set per run mode.

);
```

:::info
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this outdated as it was removed? (That an exception here would abort the account creation)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified in serverpod_auth_core_server: onAfterAuthUserCreated does run inside the same transaction as the auth user creation (the handler is called with the same transaction and exceptions propagate out, aborting the create). Re-added the info note under the example, rephrased for the user-level callback.

Zfinix added 2 commits May 11, 2026 03:25
…ions, customization tips, and additional notes on credential management
`serverpod create` already ships `serverpod_auth_idp_server` and
`serverpod_auth_idp_flutter` in the generated pubspecs, so the bare
`pub add` steps were redundant for users on the standard template.
@Zfinix Zfinix requested a review from Swiftaxe May 12, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants