This release is a pre-release and may not be stable for production use.
pyxpo-apple-authentication
Sign in with Apple for pyxpo apps written in Python. The API follows expo-apple-authentication. It runs on iOS with AuthenticationServices. You get an identity token (a JWT signed by Apple) to verify on your server.
import pyxpo_apple_authentication as AppleAuthentication
from pyxpo_apple_authentication import AppleAuthenticationScope, AppleAuthenticationError
if await AppleAuthentication.is_available_async():
try:
cred = await AppleAuthentication.sign_in_async(
requested_scopes=[AppleAuthenticationScope.FULL_NAME, AppleAuthenticationScope.EMAIL])
await api.post("/auth/apple", {"identityToken": cred["identityToken"]})
except AppleAuthenticationError as e:
if e.code != "ERR_REQUEST_CANCELED":
raise
Features
- Apple's own sheet, with Face ID and the Hide My Email relay.
- Clear errors:
AppleAuthenticationError.codeisERR_REQUEST_CANCELEDwhen the user closes the sheet. - Credential state checks, so you can sign out a user who revoked the app in Settings.
- Config plugin for the
com.apple.developer.applesigninentitlement, so you never edit the entitlements file. - Safe on every platform:
is_available_async()isFalseon Android, the web and the desktop. - camelCase too:
signInAsync(requestedScopes=...).
Contents
| If you are... | Start here |
|---|---|
| Setting up | Install · Apple Developer setup |
| Signing users in | Quick start |
| Exact names | API reference · Errors |
| Stuck | Testing · Troubleshooting |
Install
pip install pyxpo-apple-authentication
Add the module and its config plugin to your app's pyproject.toml:
[tool.pyxpo]
modules = ["apple-authentication"]
plugins = ["pyxpo_apple_authentication.plugin"]
Then rebuild the iOS app (pyxpo run ios). The plugin adds com.apple.developer.applesignin = ["Default"] to the
app entitlements.
| Platform | Engine | Minimum |
|---|---|---|
| iOS | AuthenticationServices | iOS 13 |
| Android, web, desktop | not supported (is_available_async() is False) |
Apple Developer setup
- In Certificates, Identifiers & Profiles, open your App ID and turn on Sign in with Apple.
- Make a new provisioning profile for that App ID, or let Xcode signing make it.
- On your server, verify
identityTokenagainst Apple's keys athttps://appleid.apple.com/auth/keys. Check thataudis your bundle ID andissishttps://appleid.apple.com.
The simulator needs an Apple ID signed in under Settings.
Quick start
Apple sends fullName and email only on the first sign-in of a user for your app. Send them to your server
then, with the token:
cred = await AppleAuthentication.sign_in_async(
requested_scopes=[AppleAuthenticationScope.FULL_NAME, AppleAuthenticationScope.EMAIL])
name = cred["fullName"] or {}
full = " ".join(p for p in (name.get("givenName"), name.get("familyName")) if p) or None
await api.post("/auth/apple", {"identityToken": cred["identityToken"], "fullName": full})
Check later that the user still allows your app:
from pyxpo_apple_authentication import AppleAuthenticationCredentialState as State
if await AppleAuthentication.get_credential_state_async(saved_user) is State.REVOKED:
await sign_out()
Draw your own button that follows Apple's Human Interface Guidelines (black or white, the Apple logo, "Sign in with Apple" or "Continue with Apple").
API reference
| Name | Returns | Notes |
|---|---|---|
is_available_async() |
bool |
True on iOS with the module linked. |
sign_in_async(requested_scopes=None, state=None, nonce=None) |
credential dict |
Shows Apple's sheet. |
get_credential_state_async(user) |
AppleAuthenticationCredentialState |
user is credential["user"]. |
AppleAuthenticationScope |
FULL_NAME, EMAIL |
|
AppleAuthenticationCredentialState |
REVOKED, AUTHORIZED, NOT_FOUND, TRANSFERRED |
|
AppleAuthenticationUserDetectionStatus |
UNSUPPORTED, UNKNOWN, LIKELY_REAL |
credential["realUserStatus"] |
The credential has user, state, fullName (namePrefix, givenName, middleName, familyName,
nameSuffix, nickname, or None), email, realUserStatus, identityToken and authorizationCode.
Errors
AppleAuthenticationError has code:
| Code | Meaning |
|---|---|
ERR_REQUEST_CANCELED |
The user closed the sheet. |
ERR_REQUEST_FAILED |
The request failed, for example with no Apple ID on the device. |
ERR_INVALID_RESPONSE |
Apple sent an answer without a user. |
ERR_REQUEST_NOT_HANDLED |
No provider handled the request. |
ERR_REQUEST_NOT_INTERACTIVE |
The request needed UI that the app cannot show now. |
ERR_IN_PROGRESS |
A sign-in is already open. |
ERR_REQUEST_UNKNOWN |
Anything else. |
On other platforms sign_in_async raises pyxpo.module_api.NotSupportedError.
Testing
Use FakeBridge from pyxpo to run your sign-in logic on the desktop:
from pyxpo.module_testing import FakeBridge
import pyxpo_apple_authentication as A
def test_sign_in():
with FakeBridge("ios") as fb:
fb.on("AppleAuthentication", "signIn", lambda o: {"user": "001.a", "identityToken": "t"})
assert asyncio.run(A.sign_in_async())["identityToken"] == "t"
Troubleshooting
ERR_REQUEST_UNKNOWNwith error 1000. The entitlement is missing. Add the plugin and rebuild, and turn on Sign in with Apple for the App ID.fullNameisNone. It comes only on the first sign-in. Remove the app under Settings > Apple ID > Sign in with Apple to test it again.- Simulator: nothing happens. Sign in to an Apple ID in the simulator's Settings.
License
MIT
Metadata
Release files for pyxpo-apple-authentication 0.1.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyxpo_apple_authentication-0.1.0a1.tar.gz | 12.1 kB | With provenance | Details for pyxpo_apple_authentication-0.1.0a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyxpo_apple_authentication-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details for pyxpo_apple_authentication-0.1.0a1-py3-none-any.whl |
Total release size: 22.7 kB
Release files / pyxpo_apple_authentication-0.1.0a1.tar.gz
| Download URL | pyxpo_apple_authentication-0.1.0a1.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b63e0e0caf6984f354559c843946031b3842e739ab172ea976e7ff7d8a7839dc
|
|
BLAKE2b-256 checksum How to use checksums |
2c326cda242677561fb349d847ed1fa37cfe8d4b8cf158f9b7ad7f8558105389
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / pyxpo_apple_authentication-0.1.0a1-py3-none-any.whl
| Download URL | pyxpo_apple_authentication-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5f905138282f4d356bea0f98b2c6ed299cbb9bf954560eec729a572cdb52bb6
|
|
BLAKE2b-256 checksum How to use checksums |
b15b40341a88af82ba85fca8b8f16d95a916e7f665e28b90411959a4bff0ec16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for pyxpo-apple-authentication 0.1.0a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyxpo_apple_authentication-0.1.0a1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.