Integration with salesForce


(Jessp01) #1

Hello all,

What I need to achieve is this:
0. User logins using the default Discourse method

  1. User info is then passed to Marketo using its Ruby API
  2. User continues to the forum

The SF API is here:


And that works for me, simply need to know where in the Discourse code it’s best to make the call.

Thanks,


(Justin Smits) #3

Were you ever able to get this working? If so, how does it work?


(Jessp01) #4

Hello,

I did get it to work :slight_smile:

Basically, I am using GitHub - discoursehosting/discourse-api-php: PHP API client for Discourse to which I also made a small pull request to to fix an issue with HTTPs [support HTTPs for Discourse API. by jessp01 · Pull Request #3 · discoursehosting/discourse-api-php · GitHub].

On the Discourse end, under /admin in the Settings tab, search for ‘sso’ to see the settings I am about to refer to:

Check ‘enable sso’
Enable single sign on via an external site (WARNING: USERS’ EMAIL ADDRESSES MUST BE VALIDATED BY THE EXTERNAL SITE!)

sso url - should point to your external SSO system
sso secret - some uniq string

Under /admin API tab, generate an API key

Next, as far as the code on your SSO system goes:

// where DISCOURSE_SSO_SECRET is what you set in the forum
                    $sso = new Discourse_SSO(DISCOURSE_SSO_SECRET);
// discourse will send this param as POST to your SSO URL
                    $nonce = $sso->getNonce( $_POST['payload'] );
                    $params['nonce']=$nonce;
// call login
                    $sso->login($params);

As far as Marketo goes, I am using this agent-contrib/marketo at master · kaltura/agent-contrib · GitHub
and you are welcome to it:)