oAuth2, Salesforce and custom form


(Mahearnpad) #1

I need to know if the following process flow is possible. I have a feeling that it is, but can’t seem to put it together in Matrix.

  1. User opens a custom form and fills it in
  2. On submission, obtain access token from Salesforce, using oAuth2 (RESTful endpoint)
  3. Send form responses, in JSON format, back to a 2nd Salesforce RESTful endpoint, with access token in header to authenticate user.

Cannot use client-side at all, as the access token cannot be exposed.

Is the above possible, gurus out there?

TIA


(Bart Banda) #2

Should be possible. After the 1st REST call use the JavaScript Processing area to set a Session Var value to be whatever the response is, I’m assuming it’s JSON data? In which case it should be easy to extract the token from.

Then create another REST submission action and use %globals_session_<your session var from the 1st REST call>% as the dynamic value in the 2nd REST call.


(Mahearnpad) #3

I’ve got the token. I wasn’t sure how to pass the token and the form data to the 2nd endpoint.

Didn’t try %globals_session_%. So you reckon this should work? I’ll try it on Monday.

thanks for your help Bart


(Bart Banda) #4

Yep, should work, you just need to extract the token from the data response and then put it into the session var.

Let me know how you go.