┌────┐ ┌──────┐ ┌──────────────────┐ ┌──────────────────────┐ ┌────────────────────┐ ┌────────────────────────┐ │User│ │Client│ │Social Auth Server│ │Social Resource Server│ │Internal Auth Server│ │Internal Resource Server│ └─┬──┘ └──┬───┘ └────────┬─────────┘ └──────────┬───────────┘ └─────────┬──────────┘ └───────────┬────────────┘ │ │ │ │ │ │ │ │ │ ╔═╧════════════╗ │ │ ═══════╪════════════════╪════════════════════════════════╪═════════════════════════════╣ Registration ╠═══════════════════╪═════════════════════════════════╪═════════════════════════════════ │ │ │ ╚═╤════════════╝ │ │ │ │ │ │ │ │ │ │ Authorization Code Request ┌┴┐ │ │ │ │ │ ──────────────────────────────>│ │ │ │ │ │ │ │ │ │ │ │ │ │Login & Consent │ │ │ │ │ │ ───────────────────────────────────────────────>│ │ │ │ │ │ │ └┬┘ │ │ │ │ │ Authorization Code Response │ │ │ │ │ │ <─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ │ │ │ │ │ │ │ │ │ Exchange Code for Access Token ┌┴┐ │ │ │ │ │ ──────────────────────────────>│ │ │ │ │ │ │ └┬┘ │ │ │ │ │ Access Token [+ Refresh Token] │ │ │ │ │ │ <─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ │ │ │ │ │ │ │ │ │ Call API with Access Token ┌┴┐ │ │ │ │ ──────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ │ │ │ │ ┌┴┐ Validate Access Token │ │ │ │ │ │ │ │ <───────────────────────────│ │ │ │ │ │ └┬┘ │ │ │ │ │ │ │ Valid Access Token Response │ │ │ │ │ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─> │ │ │ │ │ │ │ └┬┘ │ │ │ │ Response with User Data │ ╔═════════════════════════════╧════════════════════════════╗ │ │ │ <─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ║This data is used to create/identify an internal account ░║ │ │ │ │ │ ╚═════════════════════════════╤════════════════════════════╝ │ │ │ │ Create User [if not exists] │ ┌┴┐ │ │ │ ───────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ └┬┘ │ │ │ │ Confirm User │ │ │ │ │ <─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╔═══╧═════════════╗ │ │ ═══════╪════════════════╪════════════════════════════════╪═══════════════════════════╣ Consume Service ╠══════════════════╪═════════════════════════════════╪═════════════════════════════════ │ │ │ ╚═══╤═════════════╝ │ │ │ │ │ │ │ │ │ │ │ Authorization Code Request │ ┌┴┐ ╔════════════════════════════╧════════╗ │ │ ───────────────────────────────────────────────────────────────────────────────────────────────>│ │ ║Requested Using Social Access Token ░║ │ │ │ │ │ │ ╚════════════════════════════╤════════╝ │ │ ┌┴┐ Validate Access Token │ │ │ │ │ │ │ <────────────────────────────────────────────────────────────│ │ │ │ │ └┬┘ │ │ │ │ │ │ │ Valid Access Token Response │ │ │ │ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ > │ │ │ │ │ │ │ │ │ │ │ │ │ ┌┴┐ Get data (like username) │ │ │ │ │ │ │ │ <────────────────────────────│ │ │ │ │ │ └┬┘ │ │ │ │ │ │ │ Return user data │ │ │ │ │ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ > │ │ │ │ │ │ │ └┬┘ │ │ │ │ Authorization Code Response │ │ │ │ │ <─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ │ │ │ │ │ │ │ │Exchange Code for Access Token │ ┌┴┐ │ │ │ ───────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ └┬┘ │ │ │ │ Access Token [+ Refresh Token]│ │ │ │ │ <─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╔═══════╤════╪════════════════════════════════╪═══════════════════════════════╪════════════════════════════════╪═════════════════════════════════╪══════════════════════╗ │ ║ LOOP │ Internal microservice calls │ │ │ │ ║ │ ╟───────┘ │ │ │ │ │ ║ │ ║ │ │ Call API with Access Token │ ┌┴┐ ║ │ ║ │ ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ ║ │ ║ │ │ │ │ │ │ ║ │ ║ │ │ │ ┌┴┐ Validate Access Token │ │ ║ │ ║ │ │ │ │ │ <─────────────────────────────│ │ ║ │ ║ │ │ │ └┬┘ │ │ ║ │ ║ │ │ │ │ Validate Access Token │ │ ║ │ ║ │ │ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─> │ │ ║ │ ║ │ │ │ │ └┬┘ ║ │ ║ │ │ Response with Data │ │ ║ │ ║ │ <─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ║ │ ╚════════════╪════════════════════════════════╪═══════════════════════════════╪════════════════════════════════╪═════════════════════════════════╪══════════════════════╝ ┌─┴──┐ ┌──┴───┐ ┌────────┴─────────┐ ┌──────────┴───────────┐ ┌─────────┴──────────┐ ┌───────────┴────────────┐ │User│ │Client│ │Social Auth Server│ │Social Resource Server│ │Internal Auth Server│ │Internal Resource Server│ └────┘ └──────┘ └──────────────────┘ └──────────────────────┘ └────────────────────┘ └────────────────────────┘