Secure sign-in with OAuth 2.0 and PKCE
OAuth 2.0 authorization code flow with PKCE support — the flow behind single sign-on.
- The user clicks “Sign in”; the app can generate a PKCE code_verifier.
- The app sends the user to /oauth/authorize with its client_id, scopes and a code_challenge.
- The identity provider authenticates the user, records consent and returns a one-time code.
- The app exchanges the code at /oauth/token for a Bearer access token and reads the profile from /api/me.
Context
My-IT is the single account behind the ecosystem: PayX, ORAX, Telegroup, ITProduct and other services sign users in through it.
Technical challenge
Every service must know who the user is without ever handling their password — including browser apps that cannot keep a client secret.
Chosen solution
An OAuth 2.0 authorization server on Laravel Passport: authorization code flow with PKCE support, a profile endpoint (/api/me), and one account center for consents, devices and sessions.
Trade-offs
A central identity provider is a dependency for the whole ecosystem; in return, security controls and session management live in one place instead of in every service.
Result
One sign-in across 9 services; a new service connects as an OAuth client instead of building its own login.
All deep dives