GitHub user CatalyseRichard added a comment to the discussion: Is there a way 
to do OAuth with Salesforce Input?

There is a way to do OAuth using the native javascript 'jsrsasign' libraries. 
We used it where we needed a JWT token in order to authenticate to a rest 
server.  
I don't have a generic example I can post but I'll try to find time to create 
one for you.  
In essence it goes as follows:

1. Obtain the jsrsasign library file and add it to a source-file folder
2. In a javascript transform use item0 tab to import the  js library.
- Note that you need variables to set both 'navigator' and 'window' values to 
"other" to ensure browser compatibility.
- Use 'LoadScriptFile(<jsrsa_file>) ; to import the library

3. The generic javascript for the main code tab (Script1) is attached here. It 
gets a token (JWT) and attaches it to a bearer which you would then use in the 
Rest call.

That's the most awkward part and works really well to get JWT tokens. You'd 
need other coding if you want to get other sorts of tokens - but the good thing 
is that the library will handle most OAuth methods.
[JWT_js_code.txt](https://github.com/user-attachments/files/18012534/JWT_js_code.txt)

Hope that helps a bit.

GitHub link: 
https://github.com/apache/hop/discussions/4653#discussioncomment-11464706

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to