Added Playwright Token Refresher Service#224
Merged
Conversation
e92bcdb to
d120a02
Compare
…ation - Refresher FastAPI + Playwright service with /refresh, /seed, /health, /contexts endpoints - /seed accepts cookies from mobile app WebView to bootstrap Playwright browser context - /refresh navigates Schulnetz with seeded cookies, Microsoft SSO auto-passes, captures code - Route interception catches schulnetz.web.app redirect to extract PKCE code - Exchanges code for mobile tokens via token.php + captures PHPSESSID via loginto.php - Docker container with Playwright + Chromium headless (playwright install --with-deps) - Sync task: falls back to Playwright refresher when token.php returns biometric_required - Uses account ID as refresher context key (consistent between app and sync task) - Fixed entity tracking: db.Accounts.Update() for reliable persistence - Fixed FindOrCreateExam: creates Class from grade course when no classes exist Tested end-to-end: - Forced token expiry in DB (set to 2020) - Sync task detected expiry, called Playwright refresher - Refresher returned fresh access_token + refresh_token + PHPSESSID - Token expiry updated to 1 hour from now - Sync continued with fresh tokens, grades synced to main DB resolve #79
d120a02 to
f5948c6
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
Standalone FastAPI + Playwright service that refreshes Schulnetz tokens and web sessions automatically.
Refresher service (
plugins/Schuly.Plugin.Schulware/refresher/)POST /refresh— opens Schulnetz in headless Chromium, re-does Microsoft SSO, returns fresh tokens + PHPSESSIDGET /health— status checkDELETE /contexts/{user_id}— clear cached sessionSync task update
TryRefreshTokennow falls back to Playwright refresher whentoken.phpreturnsbiometric_requiredSCHULWARE_REFRESHER_URLenv varTest plan