function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CuriosityCuriosity 

How to read relayState parameter in SAML reponse using Apex on Force.com?

I am using my Force.com (Unlimited Edition) org as the IDP(Identity Provider) and at the same time I have created a Customer Community on that same org which I want to use as my SP (service provider). The pre-login URL to my SP has some parameters in it which must be available after login as well.
Problem is that although I am able to successfully login to my SP using my IDP, the query string parameters are no more available after login. E.g.,
Before login my community URL is: http://community.abcd.com/mysp/s/?param1=1234567ABCD
After login the URL becomes: http://community.abcd.com/mysp/s/

N.B.: My customer community is built on the Napili self service template with Lightning components.
Best Answer chosen by Curiosity
CuriosityCuriosity
Found the solution: Use the "startURL" query parameter in your Login URL.
For example, if you want to go to http://community.abcd.com/mysp/s/?param1=1234567ABCD after login then first URL encode this URL, i.e.
http%3A%2F%2Fcommunity.abcd.com%2Fmysp%2Fs%2F%3Fparam1%3D1234567ABCD

Then set the above URL encoded string as the value for the startURL parameter in your Login URL, i.e.
http://community.abcd.com/mysp/login?startURL=http%3A%2F%2Fcommunity.abcd.com%2Fmysp%2Fs%2F%3Fparam1%3D1234567ABCD