This release is a pre-release and may not be stable for production use.
pyxpo-google-sign-in
Sign in with Google for pyxpo apps written in Python. The API follows @react-native-google-signin/google-signin. Android uses Credential Manager, iOS the GoogleSignIn SDK, and the web and the desktop window Google Identity Services. You get an OpenID Connect ID token to verify on your server.
import pyxpo_google_sign_in as GoogleSignin
GoogleSignin.configure(web_client_id="1234-web.apps.googleusercontent.com",
ios_client_id="1234-ios.apps.googleusercontent.com")
res = await GoogleSignin.sign_in()
if res["type"] == "success":
await api.post("/auth/google", {"idToken": res["data"]["idToken"]})
Features
- One ID token for every platform. Its audience is your web client ID, so one server check covers Android, iOS and the web.
- Native account pickers: the Credential Manager bottom sheet on Android, Google's sheet on iOS.
- Clear outcomes:
{"type": "success"}or{"type": "cancelled"}, andGoogleSignInError.codefor the rest. - Config plugin for the iOS URL scheme, so you never edit Info.plist.
- Works on the web and the desktop with Google Identity Services, so you can develop without a phone.
- camelCase too:
GoogleSignin.signIn(),webClientId=....
Contents
| If you are... | Start here |
|---|---|
| Setting up | Install · Google Cloud setup |
| Signing users in | Quick start |
| Exact names | API reference · Errors |
| Stuck | Testing · Troubleshooting |
Install
pip install pyxpo-google-sign-in
Add the module and its config plugin to your app's pyproject.toml:
[tool.pyxpo]
modules = ["google-sign-in"]
plugins = [["pyxpo_google_sign_in.plugin", { iosClientId = "1234-ios.apps.googleusercontent.com" }]]
Then rebuild the native app (pyxpo run ios, pyxpo run android). The plugin writes GIDClientID and the reversed
client ID (com.googleusercontent.apps.1234-ios) to CFBundleURLTypes. The GoogleSignIn SDK stops the app
without that URL scheme.
| Platform | Engine | Minimum |
|---|---|---|
| Android | Credential Manager + googleid 1.1 |
API 24 |
| iOS | GoogleSignIn 8 (Swift Package) | iOS 15 |
| Web, desktop window | Google Identity Services | any current browser |
Google Cloud setup
Make three OAuth clients in one Google Cloud project (APIs & Services > Credentials):
| Client type | What you enter | Used by |
|---|---|---|
| Web application | Authorized JavaScript origins: your web app's origins (http://localhost:3000 in development) |
web_client_id on every platform; your server checks this audience |
| iOS | Bundle ID of the app | ios_client_id and the plugin |
| Android | Package name and the SHA-1 of each signing certificate (debug and release) | nothing in code: Google matches the app by package and certificate |
Get the debug SHA-1 with keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android.
Client IDs are not secret, but keep them in config rather than spread through code.
Quick start
import pyxpo_google_sign_in as GoogleSignin
from pyxpo_google_sign_in import GoogleSignInError, status_codes
GoogleSignin.configure(web_client_id=WEB_CLIENT_ID, ios_client_id=IOS_CLIENT_ID)
async def sign_in_with_google():
try:
await GoogleSignin.has_play_services()
await GoogleSignin.sign_out() # always show the account picker
res = await GoogleSignin.sign_in()
except GoogleSignInError as e:
if e.code == status_codes.IN_PROGRESS:
return None
if e.code == status_codes.PLAY_SERVICES_NOT_AVAILABLE:
return "Update Google Play services, then try again."
raise
if res["type"] == "cancelled":
return None
return await api.post("/auth/google", {"idToken": res["data"]["idToken"]})
Verify the token on the server: signature against Google's keys, iss is https://accounts.google.com, aud is
your web client ID, exp in the future, email_verified true.
API reference
| Name | Returns | Notes |
|---|---|---|
configure(web_client_id, ios_client_id=None, scopes=None, offline_access=False, hosted_domain=None) |
None |
Call once at startup. Validates the client IDs. |
await has_play_services(show_play_services_update_dialog=True) |
True |
Android only checks; raises PLAY_SERVICES_NOT_AVAILABLE. iOS and the web: True. |
await sign_in() |
response | {"type": "success", "data": {...}} or {"type": "cancelled", "data": None}. |
await sign_out() |
None |
Clears the remembered account, so the next sign-in shows the picker. |
is_success_response(r), is_cancelled_response(r) |
bool |
|
is_error_with_code(e) |
bool |
True for GoogleSignInError. |
GoogleSignin |
namespace | GoogleSignin.signIn() and friends, React Native style. |
data holds idToken, serverAuthCode (iOS with offline_access, else None), scopes and user:
id, email, name, givenName, familyName, photo. On Android id is the account email.
Errors
GoogleSignInError.code is one of status_codes:
| Code | When | What to do |
|---|---|---|
IN_PROGRESS |
sign_in() while another is open |
Ignore the second tap. |
PLAY_SERVICES_NOT_AVAILABLE |
Android without current Google Play services | Ask the user to update it. |
SIGN_IN_REQUIRED |
Android has no Google account to offer | Ask the user to add one in Settings. |
NOT_CONFIGURED |
no configure(), or no ios_client_id on iOS |
Call configure at startup. |
NO_ID_TOKEN |
Google returned no ID token | Check web_client_id is the Web application client. |
FAILED |
anything else; the message comes from the SDK | Show a generic error, log the message. |
A cancelled picker is not an error: sign_in() returns {"type": "cancelled"}.
Testing
Use FakeBridge from pyxpo to run your sign-in logic on the desktop:
from pyxpo.module_testing import FakeBridge
import pyxpo_google_sign_in as G
def test_sign_in():
G.configure(web_client_id="1-w.apps.googleusercontent.com")
with FakeBridge("android") as fb:
fb.on("GoogleSignIn", "signIn", lambda cfg: {"type": "success", "data": {"idToken": "t", "user": {}}})
assert asyncio.run(G.sign_in())["data"]["idToken"] == "t"
Troubleshooting
- Android:
FAILED: ... 10or "developer console is not set up correctly". The Android OAuth client is missing the SHA-1 of the certificate that signed this build. Add the debug and the release SHA-1. - iOS: the app stops at sign-in. The URL scheme is missing. Add the plugin with
iosClientIdand rebuild. - Web: "The given origin is not allowed". Add the page origin to the web client's Authorized JavaScript origins.
NO_ID_TOKEN.web_client_idis an Android or iOS client. Use the Web application client.
License
MIT
Metadata
Release files for pyxpo-google-sign-in 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_google_sign_in-0.1.0a1.tar.gz | 17.8 kB | With provenance | Details for pyxpo_google_sign_in-0.1.0a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyxpo_google_sign_in-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details for pyxpo_google_sign_in-0.1.0a1-py3-none-any.whl |
Total release size: 33.7 kB
Release files / pyxpo_google_sign_in-0.1.0a1.tar.gz
| Download URL | pyxpo_google_sign_in-0.1.0a1.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d93fe2f8bc2c26dfeef456c77244295854c441c921588886072f4a31a2cc1564
|
|
BLAKE2b-256 checksum How to use checksums |
00d4a72c872358193e7e426573d04b578ec5dd66b7279d405138a1f0e84bcd73
|
| 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_google_sign_in-0.1.0a1-py3-none-any.whl
| Download URL | pyxpo_google_sign_in-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66db5086bc47c827641da0d24571404abc17243f6d9fb0b02d111cdb783fc65e
|
|
BLAKE2b-256 checksum How to use checksums |
90651a1b2b5f31cd3e93c6342117549ed3498e8791d31a60edba1226e7969bc4
|
| 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-google-sign-in 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_google_sign_in-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.