0

I'm pretty new to SalesForce and their Apex language. I've been reading some documentation and tried the integration between Google and SalesForce.

I'm wondering is it possible to emulate an auth token from google to SalesForce?

I'm trying to read a google spreadsheet and then fill up a SalesForce object automatically. The user login will always be the same/universal for this spreadsheet, so I have the credentials required to login. I am working off of the sample that requires a visualforce, and I'm wondering how would I automatically do the session id token that the google spreadsheet API requires.

Any ideas?

4

4 回答 4

1

老式的、困难的方法是向 API 发送login()调用(可通过 SOAP 消息获得)。Salesforce API 有据可查,并且有大量示例可用(编程语言和原始 XML 请求/响应)。

但我不知道你从谷歌方面有什么可能性,如果它只是 JavaScript,那么你可能无法向另一个域发送和检索类似 AJAX 的调用......

最近出现了另一种选择,那就是 REST API(不需要 SOAP)。在我看来,这看起来更有希望也更容易。此处提供快速介绍,您可以在页面底部找到更多文档。

最后但并非最不重要 - 2 个有趣的链接: http ://code.google.com/apis/gdata/articles/salesforce.html一些集成教程和 Salesforce 提供的内置集成:http: //www.salesforce.com /assets/pdf/datasheets/SalesforceGoogleApps.pdf

于 2010-10-27T19:08:22.993 回答
1

我已经使用自定义设置来做到这一点。使用 OAuth 为 Google 获取令牌,然后将该令牌存储在 Salesforce 自定义设置(设置-开发-自定义设置)中。然后,您可以从该自定义设置中为需要访问 Google Apps 的任何用户检索用于向 Google 调用的令牌。缺点是,每个用户都将作为您的自定义设置令牌用户进行身份验证。好处是他们不需要单独进行身份验证。自定义设置可通过 Apex 使用简单的 getter 进行检索,并作为 Apex 类对象存在。

另请记住,Google 要求每项服务都使用自己的令牌。因此,如果您的用户想要使用日历和电子表格,则需要为标注存储和检索这两个单独的令牌。

如果用户想要这样做,我通常允许用户通过 OAuth 创建他们自己的经过身份验证的会话令牌,然后在必要时故障转移到自定义设置以获取通用管理员令牌。

于 2010-11-02T19:12:17.840 回答
0

您是否尝试从 SFDC 登录 Google Apps?Salesforce 中有 Google Apps 选项,请转到设置 > 管理设置 > Google Apps > 设置。我没有使用过它,它需要一些设置,但我想我会指出它。除此之外,我只能脱口而出 OAuth(让用户在尝试访问 Google Apps 时从 Salesforce 内部向 Google 进行身份验证)和 SSO(我知道它可用于从外部系统进行身份验证,但不确定它是否适用于其他系统)方法)。

于 2010-10-29T08:35:04.657 回答
0

查看 Salesforce 设置中的“命名凭据”菜单。在那里,您可以存储通过 Apex 访问的服务的身份验证凭据:

“命名凭据指定标注端点及其所需的身份验证参数。设置标注时,请避免通过引用命名凭据为每个标注设置身份验证参数。”

可以使用用户名/密码组合,或者证书,或者 AWS 签名,并且有一个 JWT 选项。

帮助文档:https ://help.salesforce.com/articleView?id=named_credentials_about.htm&type=5

于 2019-08-06T18:38:28.640 回答