The application was showing redirect_uri not valid for this client error because:
- The registered callback with CILogon is:
https://lmarinve.github.io/multi-provider-authe/auth/callback/cilogon - The app was sometimes generating URLs with different domains (e.g., GitHub Codespaces URLs)
- Updated
src/lib/config.tsto always use the registered GitHub Pages URL - Removed dynamic URL detection to prevent domain mismatches
- Base URL is now hardcoded:
https://lmarinve.github.io/multi-provider-authe
- Set
base: "/multi-provider-authe/"invite.config.ts - Added GitHub Pages SPA plugin to create proper
404.html - Fixed asset paths to work with GitHub Pages routing
The callback system is now properly configured:
public/auth/callback/cilogon/index.html - CILogon callback page
public/auth/callback/orcid/index.html - ORCID callback page
- CILogon provider always uses registered redirect URI
- PKCE implementation generates proper base64url without padding
- State parameter validation ensures security
- Proper localStorage handling for cross-origin compatibility
Updated TokenData interface to support both id_token and access_token:
export interface TokenData {
id_token?: string;
access_token?: string;
refresh_token?: string;
expires_in: number;
issued_at: number;
provider: "cilogon" | "orcid" | "fabric";
}- Client ID:
cilogon:/client_id/e33e29a20f84e0edd144d1e9a6e2b0 - Registered Callback:
https://lmarinve.github.io/multi-provider-authe/auth/callback/cilogon - Auth URL:
https://cilogon.org/authorize - Token URL:
https://cilogon.org/oauth2/token - Scope:
openid(only scope allowed with Strict Scopes) - PKCE: Required with S256 method
public/auth/callback/cilogon/index.html- Must exist at this exact pathpublic/404.html- For SPA routing on GitHub Pagesvite.config.ts- With correct base path configuration
Run the app locally with the dev server to test authentication flows.
- Build the project with Vite
- Deploy to GitHub Pages
- Access the app at:
https://lmarinve.github.io/multi-provider-authe/ - Test CILogon authentication by:
- Selecting CILogon provider
- Clicking "Login with CILogon"
- Verifying popup opens to CILogon
- Completing authentication on CILogon
- Verifying redirect back to callback page
- Confirming token is received and stored
- Verify the callback page loads at:
https://lmarinve.github.io/multi-provider-authe/auth/callback/cilogon - Check browser console for CORS errors
- Verify generated auth URL matches expected format:
https://cilogon.org/authorize?response_type=code&client_id=cilogon:/client_id/e33e29a20f84e0edd144d1e9a6e2b0&redirect_uri=https%3A%2F%2Flmarinve.github.io%2Fmulti-provider-authe%2Fauth%2Fcallback%2Fcilogon&scope=openid&state=...&code_challenge=...&code_challenge_method=S256 - Ensure popup is not blocked by browser
- Verify localStorage persistence of PKCE values
- User clicks "Login with CILogon"
- App generates PKCE values and state
- App opens popup with CILogon auth URL
- User authenticates with institution via CILogon
- CILogon redirects to callback page with
?code=...&state=... - Callback page sends success message to parent window
- Parent window exchanges code for tokens using PKCE
- Tokens are stored in localStorage
- User is redirected to token page
All configuration is now aligned with the registered CILogon client settings.