When using OAuth with SAML 2.0 authentication, the RelayState value in a SAMLRequest may exceed 80 characters. According to the SAML 2.0 standard (section 3.4.3 of the OASIS SAML Bindings document), the RelayState value must not exceed 80 bytes in length.
However, Salesforce does not enforce this restriction for the following reason: when Salesforce acts as a Service Provider in an OAuth flow, it must include routing information in the RelayState to complete the OAuth authorization after the user is authenticated. This routing information can exceed 80 bytes.
Why Salesforce Exceeds the 80-Byte RelayState Limit
When a user authenticates via an OAuth User-Agent flow, the following sequence occurs:
Salesforce intentionally does not enforce the 80-byte RelayState limit because doing so would break standard OAuth User-Agent flows that require IdP-initiated SAML authentication.
If you implement a custom Identity Provider (IdP) or use a third-party IdP with strict SAML 2.0 compliance settings, configure it to:
This is consistent with current industry usage of SAML 2.0 and Salesforce's documented approach to supporting OAuth-integrated SAML authentication.
000387925

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.