🔒️(backend) secure native app OIDC login with one-time exchange codes#1170
Open
🔒️(backend) secure native app OIDC login with one-time exchange codes#1170
Conversation
This was referenced Mar 20, 2026
ff5e8ec to
e148d6b
Compare
Add one-time exchange code mechanism for native app OIDC login. Instead of exposing session ID in redirect URL, generates a short-lived single-use code stored in Redis. Native apps exchange this code for the session ID via a dedicated API endpoint. Includes NativeAppRedirect for custom URL schemes, rate limiting, logging, and whitelist of allowed schemes. Closes #1153 Co-Authored-By: gigi206
cb32adb to
724a4ef
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
NATIVE_APP_REDIRECT_SCHEMESsetting, defaults to["visio"])Changes
src/backend/core/authentication/views.py— Custom OIDC callback view that generates a UUID exchange code for whitelisted custom-scheme redirects, stored in cache with 30s TTLsrc/backend/core/authentication/api.py— NewPOST /api/v1.0/auth/session-exchange/endpoint: validates exchange code, returns session ID, deletes code (single-use)src/backend/core/urls.py— Route registration for the exchange endpointsrc/backend/meet/settings.py—OIDC_CALLBACK_CLASSpointed to custom view + newNATIVE_APP_REDIRECT_SCHEMESsetting (configurable via env var)src/backend/core/tests/authentication/test_session_exchange.py— 8 testsSecurity improvements over #1153
session_keyin redirectNATIVE_APP_REDIRECT_SCHEMES(default:["visio"])Tests
8 tests covering:
SESSION_COOKIE_NAMEsettingAll 74 existing authentication + user tests pass with no regression.
Context
Native mobile/desktop apps (Visio Mobile) authenticate via OIDC using the system browser. The browser cannot share cookies back to the app. This change provides a secure way to pass authentication back:
visio://auth-callback?code=<uuid>(instead of?session_id=<key>){"code": "<uuid>"}to/api/v1.0/auth/session-exchange/{"meet_sessionid": "<session_key>"}and deletes the codeTest plan
Supersedes #1153