TL;DR
Yes, a service provider (SP) can communicate directly with an identity provider (IdP), but it’s usually done through standard protocols like SAML, OAuth 2.0, or OpenID Connect. Direct communication isn’t about SP calling IdP APIs directly for every user; it’s about establishing trust and exchanging security information.
Understanding the Players
Before we dive in, let’s clarify what each part does:
- Service Provider (SP): The application or service you’re using – like your online banking or a cloud storage platform.
- Identity Provider (IdP): The system that verifies user identities – like Google, Microsoft, or your company’s internal login system.
How Communication Happens
SPs don’t typically make direct API calls to IdPs for every single user action. Instead, they use protocols designed for secure identity management.
1. SAML (Security Assertion Markup Language)
- User Request: You try to log in to a service provider.
- Redirection: The SP redirects you to the IdP.
- Authentication: You log in at the IdP (e.g., enter your username and password).
- Assertion: The IdP creates a SAML assertion – a secure statement about your identity.
- Response: The IdP sends this assertion back to the SP.
- Access Granted: The SP trusts the assertion (if it’s valid) and lets you in.
SAML relies on XML-based messages exchanged between the SP and IdP.
<saml2:Assertion ...>
2. OAuth 2.0 & OpenID Connect
- User Request: You try to log in using a social provider (e.g., Google).
- Authorization Request: The SP redirects you to the IdP’s authorization endpoint.
- Authentication & Consent: You authenticate with the IdP and grant permission for the SP to access certain information.
- Authorization Code: The IdP sends an authorization code back to the SP.
- Token Exchange: The SP exchanges this code for an access token (and often a refresh token).
- API Access: The SP uses the access token to call the IdP’s APIs on your behalf.
OAuth 2.0 is primarily about authorization, while OpenID Connect adds identity information on top of OAuth 2.0.
POST /token HTTP/1.1
3. SCIM (System for Cross-domain Identity Management)
- Provisioning: When a new user is created in the SP, it can automatically create an account in the IdP using SCIM.
- Deprovisioning: When a user is deleted from the SP, it can automatically delete the account in the IdP.
- Attribute Updates: Changes to user information (e.g., name, email) can be synchronized between the SP and IdP.
SCIM uses RESTful APIs for managing user accounts.
PUT /Users/{id}
Security Considerations
- Trust Relationships: The SP must trust the IdP, and vice versa. This is usually established through certificates and metadata exchange.
- Encryption: All communication should be encrypted using HTTPS.
- Token Validation: The SP must carefully validate any tokens it receives from the IdP to prevent fraud.
- cyber security best practices: Regularly review your integration configuration and update libraries to address vulnerabilities.

