Understand the OAuth2 SSO Flow
masterThis project implements Single Sign-On (SSO) using the OAuth2 protocol. The flow works as follows:
- Access Client: User visits
client1. - Redirect:
client1redirects the request tosso-server. - Authorization: User agrees to the authorization.
- Authorization Code:
sso-serverreturns an authorization code (code) toclient1. - Token Request:
client1exchanges thecodefor a token. - JWT Token:
sso-serverreturns aJWTtoken. - Login:
client1parses the token and logs the user in. - Cross-Client Access: When the user visits
client2,client2redirects tosso-server. - Seamless Auth: Since the user is already authenticated at
sso-server, the authorization is granted automatically. - Token Exchange:
client2receives acode, exchanges it for aJWTtoken, and logs the user in.
Key Note: While client1 and client2 receive different tokens, the underlying user information extracted from the tokens is identical because they are issued by the same sso-server.
User session state and credential verification are managed exclusively by the sso-server authentication center.