When your code integrates with OpenID Connect, authentication state can drift. Resetting a branch without considering OIDC can lead to mismatched tokens, invalid sessions, and broken sign-in flows. A git reset --hard can roll back code, but your OIDC configuration, secrets, and integration points may still point to an outdated or incompatible state.
Soft, Mixed, and Hard Resets with OIDC in Mind
- Soft reset: Keeps changes staged, ideal for quickly fixing an OIDC callback or client configuration without losing work.
- Mixed reset: Resets the index, keeps working files. Useful for reviewing changes to OIDC middleware before commit.
- Hard reset: Clears everything to a specific commit. Use only if you’re sure you have backups or the OIDC settings are versioned securely.
Version-Controlled OIDC Configuration
Always store OIDC client IDs, issuer URLs, and scopes in environment variables under versioned templates (.env.example). This lets you reset without losing critical mapping between code and identity provider setup.
Testing After Reset
After any reset, run the full OIDC authentication flow locally. Initiate a fresh login, exchange the authorization code, and verify ID token claims. Test token refreshes if your app uses long-lived sessions. This ensures reset operations haven’t silently broken the handshake with your identity provider.