Loading

How to Pass RelayState from an Identity Provider (IDP) in Salesforce SAML Single Sign-On (SSO)

Дата публикации: Apr 27, 2026
Описание

In Salesforce Single Sign-On (SSO) configurations that use SAML (Security Assertion Markup Language), RelayState is an optional HTTP parameter that can be included alongside a SAML authentication request. It specifies the exact Salesforce page a user should land on after successfully authenticating through an Identity Provider (IDP) — also referred to as an IdP.
This is particularly useful when you want users to be redirected to a specific Salesforce page — such as a Visualforce page, a record detail page, or a specific app — rather than the default Salesforce home page after login.
RelayState is part of the SAML standard and is supported by Salesforce when Salesforce is configured as the Service Provider (SP).

Решение
 

How RelayState Works in Salesforce SSO

RelayState is sent as an HTTP query parameter in the IDP-initiated login URL. After a user successfully authenticates with the Identity Provider, Salesforce reads the RelayState value and redirects the user to the specified Salesforce page.

Steps to Configure RelayState in Your IDP

To direct users to a specific Salesforce page after login, append &RelayState= to the end of your IDP-initiated login URL. The value must be a valid Salesforce relative URL (a path within your Salesforce org).
Example:
If your IDP-initiated login URL is: `
To redirect users to a Visualforce page named "test" after login, append the RelayState parameter: `<REDACTED>

Important Limitations

  • RelayState must be a valid Salesforce (SFDC) URL. External URLs (pointing to sites outside your Salesforce org) will fail with an "Invalid Page Redirection" error.
  • This behavior is specific to configurations where Salesforce is acting as the Service Provider (SP), not as the Identity Provider.
  • If your RelayState value is returned as null or empty by the IDP, refer to the related article below.

 

Дополнительные ресурсы
Номер статьи базы знаний

000386068

 
Загрузка
Salesforce Help | Article