We have a working external identity provider SSO Oauth 2.0 with custom apex provider. (External app redirects to a specific SF community) We need to extend it to accept a custom parameter from the incoming url in the initiate() Auth.AuthProviderPluginClass method to be able to redirect the user to a specific record.
URL.getSalesforceBaseUrl() and ApexPages.currentPage().getUrl() are obviously not working.
Is there any way to get the URL parameter in the initiate() method to change the redirect url?
Or is there any way to change the redirect url in the custom handler where we already have the user context? (PageRreference is returned already in the provider, before getting information about the user)