Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to authenticate NiFi processor on SFDC REST API calls

Solved Go to solution

How to authenticate NiFi processor on SFDC REST API calls

Contributor

We used the InvokeHTTP processor in NiFi on Salesforce REST API (POST action, to effect changes in customer data). Salesforce requires authentication in using of its REST endpoints. Is the InvokeHTTP the right processor for this requirement? How do we maintain authenticated connection / session to REST API?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to authenticate NiFi processor on SFDC REST API calls

Super Guru

According to this, Salesforce requires authentication via OAuth 2.0. Please see this HCC article for a discussion (and related links) on how to achieve this. The question is about the GetHttp processor but should apply to InvokeHttp as well.

View solution in original post

4 REPLIES 4
Highlighted

Re: How to authenticate NiFi processor on SFDC REST API calls

Super Guru

According to this, Salesforce requires authentication via OAuth 2.0. Please see this HCC article for a discussion (and related links) on how to achieve this. The question is about the GetHttp processor but should apply to InvokeHttp as well.

View solution in original post

Highlighted

Re: How to authenticate NiFi processor on SFDC REST API calls

Contributor

Thanks for the tip Matt. I am now in the part where I have two InvokeHTTP processors, the first for login or getting the access token (let's call this SFDCLogin), and the second is where the SFDC REST API is configured for posting changes to SalesForce's ObjectStore (let's call this SFDCUpdate). I having a hard time doing the plumbing on this. The idea is, the FlowFiles (wherever they come from, assuming its GetFile processor) would move to SFDCUpdate and then if rebuffed due to missing or expired access token, will go to SFDCLogin processor and do whatever it needs to do and then go to SFDCUpdate. Note that I only need to pass through SFDCLogin once, once authenticated; not multiple times. Any custom logic, attribute, property, or expression language to make this work?

I also tried using the ExecuteScript processor using ECMAScript or Python, and do the REST API calls there on the login part. However, I'm hitting a roadblock on XMLHttpRequest (in ECMAScript) or requests (in Python) as it seems I need to point to their libraries. Should I be using a Java library (jar of HttpComponents perhaps) instead as these scripting languages are meant to wrappers only? Or can I point to their respective libraries natively?

Highlighted

Re: How to authenticate NiFi processor on SFDC REST API calls

New Contributor

Hi, 

 

Its been a long time now. Not sure, you are still on track with NiFi. Just to know how do you achieve this. Can you share some insights? 

Highlighted

Re: How to authenticate NiFi processor on SFDC REST API calls

Community Manager

Hi @Kart

 

As this is a thread which was marked 'Solved' over three years ago, you would have a better chance of receiving a resolution by posting a new question. This will also present you with the opportunity to include details specific to your environment that could aid other members in providing a more relevant answer to your question.

 

 

Bill Brooks, Community Manager
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Don't have an account?
Coming from Hortonworks? Activate your account here