Shopfloor Mobile Base auth via Google/Apple sign-in
On this page
Lets a technician sign into a Shopfloor mobile app (e.g. shopfloor_repair_mobile) with
their own Google or Apple account instead of typing an auth.api.key by hand.
Google/Apple's job is entirely a login-time alternative — once signed in, the app
holds a real auth.api.key and every REST call after that carries it in the API-KEY header exactly as it would for an api_key-flavored app. See shopfloor_mobile_base_auth_api_key, which this module reuses directly rather than
duplicating.
Setup
Install this module. It adds
"oauth"as ashopfloor.appauth type alongside the existing"api_key".Google Cloud Console: create an OAuth 2.0 Web client. Redirect URI must be
https://<host>/auth_oauth/signinexactly — this is hardcoded inauth_oidc's token-exchange call, not configurable per app. Setclient_id/client_secreton the seeded Google (Shopfloor) provider and enable it.Apple Developer portal: register an App ID and a Services ID (the Services ID is the
client_id), enable Sign in with Apple, use the same redirect URL, generate a.p8signing key, and note the Team ID and Key ID. Fill in the seeded Apple (Shopfloor) provider'sapple_team_id/apple_key_id/apple_private_key, then run_cron_rotate_apple_client_secret()once by hand (Settings > Technical > Scheduled Actions) to populateclient_secretbefore enabling it — Apple doesn't issue a static one; it's minted here as a signed JWT, capped at Apple's own 180-day limit, and re-minted monthly by that same cron.On the
shopfloor.apprecord: set Auth Type to Social login (Google/Apple), then Allowed API key groups (from the api_key module) to whichever group(s) technicians' keys already live in.Leave Auto-provision API key off (the default) to keep today's policy: an admin creates each technician's
auth.api.keyby hand, and a signed-in technician with none is denied and told to ask for one.Turn it on, and set Group for auto-provisioned keys (which must also be one of the app's own allowed groups), to mint a key automatically on first login instead.
Leave Allow sign-up off (the default) unless you actually want Odoo's own auth_oauth sign-up flow to run for an unmatched identity — see Limitations below for what "unmatched" means in practice before turning this on.
Security notes, flagged explicitly rather than shipped silently
/auth_oauth/signingetscsrf=False. Needed only for Apple, whose mandatoryresponse_mode=form_postdelivers its callback as a cross-site POST with no Odoocsrf_tokenattached. This endpoint's real security boundary is JWKS signature verification of theid_tokenplus PKCE — both untouched — not Odoo's ambient-session CSRF token, which was never a meaningful defense for a third-party redirect callback to begin with.The login is instance-wide, not per-app. Odoo's OAuth redirect URI is fixed at
/auth_oauth/signin, so any enabledauth.oauth.providershows up as a login button on every oauth-flavored Shopfloor app, and the same Google/Apple buttons also appear on the normal/web/loginscreen — there is no per-app provider allow-list. If a provider is only meant for one audience, itsenabledflag is the only lever; don't enable a Shopfloor provider you don't want desktop staff logging in with too, or vice versa.The API key travels as a URL fragment (
#apikey=...), never a query param, specifically so it never lands in server access logs or aRefererheader. It's captured and stripped from the address bar before the app's router or any other code looks at it.
Limitations
"Pre-existing accounts only" needs the account linked once, not just created. Core
auth_oauthmatches an incoming Google/Apple identity to ares.usersrecord by a stored(oauth_uid, oauth_provider_id)pair, never by matching login/email against an admin-created account — so a technician whose Odoo user was created the normal way (no prior OAuth login) is rejected on their first Google/Apple sign-in attempt regardless of the Allow sign-up setting above, not auto-linked to their existing account. Turning Allow sign-up on doesn't fix this either: it makes Odoo's sign-up flow create a brand-new, separateres.usersrecord instead (duplicating, not linking, the existing technician account). Give each technician one normal/web/loginGoogle/Apple sign-in first (which does link their account, since sign-up is allowed there by default) before they rely on it in the Shopfloor app, or link the pair by hand (oauth_uid+oauth_provider_idon theirres.usersrecord).No automated test harness covers OAuth click-through today (matching the rest of this stack) — verification is the manual pass in the original implementation plan.