Salesforce - Immortal access token

时间:2017-04-10 01:06:34

标签: salesforce access-token

I am trying to integrate Salesforce REST api into the contact form on our website.

Basically, whenever a person submits a contact form, a record in salesforce is created. I got it work but only with the token obtained via login request.

As sending two requests to handle a contact form is too much, I am looking for something long-lived that I can put directly to the code as static value. Does Salesforce support this kind of access token?

Thanks in advance.

1 个答案:

答案 0 :(得分:1)

我不知道在某个时间点没有到期的accessstoken / sessionId。

根据呼叫的频率,我通常会保留最后一个有效的会话ID并使用它,直到Salesforce指示它已过期。此时,我将执行一次性过程以建立当前会话ID。

您可以获得refreshtoken via an OAuth flow,然后根据需要使用它重新建立会话。 JWT Bearer Token Flow也是一种选择。

顺便说一下,Salesforce StackExchange是向Salesforce提出具体问题的好地方。