From 0767727d86859fe254c2b1cd550a6542fade67db Mon Sep 17 00:00:00 2001 From: JS Ng Date: Mon, 6 Apr 2026 10:47:42 +0800 Subject: [PATCH 1/2] refactor(auth): use provider endpoint directly instead of campus oauth proxy - Use app's own callback URL as redirect_uri instead of proxy callback - Use /auth/v1/authorize provider endpoint directly instead of /campus/authorize proxy - Remove unnecessary target parameter from authorization URL The campus oauth proxy pattern doesn't make sense for cross-domain deployments since the provider's /authorize endpoint handles the flow and redirects directly to the app's callback. Co-Authored-By: Claude Opus 4.6 --- campus_python/auth/v1/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/campus_python/auth/v1/__init__.py b/campus_python/auth/v1/__init__.py index 41f9263..f8dbf0c 100644 --- a/campus_python/auth/v1/__init__.py +++ b/campus_python/auth/v1/__init__.py @@ -113,19 +113,20 @@ def authorize( """ from urllib.parse import urlencode - redirect_uri = self.base_url + self.make_path("/campus/callback") + # Use the app's own callback URL instead of going through campus proxy + redirect_uri = target + auth_session = self.sessions.new( - redirect_uri=redirect_uri, # unused but can't be empty + redirect_uri=redirect_uri, scopes=["campus.profile"], target=target, ) - # Construct Campus OAuth Proxy URL with target parameter - authorize_url = self.base_url + self.make_path("campus/authorize") + # Construct Campus OAuth Provider URL (using provider directly, not proxy) + authorize_url = self.base_url + self.make_path("authorize") params = { "client_id": env.CLIENT_ID, "state": auth_session.id, - "target": target, } full_url = f"{authorize_url}?{urlencode(params)}" From 06c1257005d281fa3c7a441f84cd897b344cd964 Mon Sep 17 00:00:00 2001 From: JS Ng Date: Mon, 6 Apr 2026 13:21:53 +0800 Subject: [PATCH 2/2] chore: bump version to 0.1.48 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 82d23da..86d6561 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "campus-api-python" -version = "0.1.47" +version = "0.1.48" description = "Campus API for Python projects" authors = ["NYJC Computing "]