1

I am configuring Single Sign On for my application through OAuth 2.0 server.
I used the next recommendations:
https://help.salesforce.com/articleView?id=sso_provider_plugin_custom.htm&type=5#plugin_setup

Following this link I created my custom Auth. Provider which uses:
1. CustomPlugin extends Auth.AuthProviderPluginClass
2. CustomRegistrationHandler implements Auth.RegistrationHandler

Provider contains Test-Only Initialization URL and Single Sign-On Initialization URL.
When I send a request using the Test-Only Initialization URL I get a response with UserData in xml format:
enter image description here

It means that interactions between salesforce and my OAuth server work as expected.

Then I try to use Single Sign-On Initialization URL. The response is the next:

enter image description here

I tried to debug my Plugin and RegistrationHandler classes.
It looks likes Plugin is correct.

Logs for RegistrationHandler operation name is RegistrationHandlerUserUpdate(even if I log in external app as a new user - why update and not create?).
I have System.debug('message) at the first string of every method(create/update and canCreate).

Debug level is relevant(I use the same debug level in Plugin debug and I see such messages in Plugin logs).

But I don't see these messages in RegistrationHandler logs.

RegistrationHandler debug logs ends with:

enter image description here

Could you give me a hint how I can resolve it?

  • If you are not getting anything in the Plugin implementation and that this is an internal error, you may need to reach out to Salesforce support for this. As for the logs for registration handler, the logs do show it as "RegistrationHandlerUserUpdate" but it will print accurately if the flow went to create vs. update. Also one thing to note is that, create is called only once, very first time when you authenticate the user, and thereafter its always the update. – Jayant Das Mar 10 at 15:00
  • @JayantDas All registration handler examples show for create: create contact, create user with contactId. For update: update user. But contact contain user LastName and FirstName, why don't we update contacts? – Donatello Mar 27 at 9:52
1

For me it worked:

UserData should contains at least an empty Map of attributes(the last paramter in constructor). Otherwise you will recieve Internal Server error.

| improve this answer | |
  • I was running into the same and putting an empty Map<String, String> in the attributeMap part of the Auth.UserInfo solved this. But it sounds like something that Salesforce should be able to handle on their side of the framework. – Folkert Jun 23 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.