1

I have a marketing site for my company and prospective clients will fill up a form to show interest. Now I need to put these people as contacts in my salesforce org. So want to create a rails job which will connect to salesforce and create contacts using REST API.

I am using the restforce gem. But I cannot use OAuth flow where I need to type in username and password (because this is a backend process to create contact).

How can I use JWT bearer token authentication with restforce? JWT provides a decoded token, but does not provide any refresh token.

Do I need to pass the decoded token as oauth_token to new restforce object?

1 Answer 1

0

From what it looks like, you would have to write a new Faraday::Middleware layer. Based on what I see in the Restforce middleware, it recovers from unauthenticated requests by using the refresh_token flow. I don't see evidence that JWT is supported.

The way I would accomplish this is by adding a layer similar to the token layer which would encode a JWT payload and sending that instead of the token payload. The ruby-jwt gem looks like a good way to create that JWT payload.

In short, I don't see evidence that it works out of the box.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .