简体   繁体   English

Docusign 服务集成认证

[英]Docusign Service Integration Authentication

I am creating a service integration that will need to use my Docusign account.我正在创建一个需要使用我的 Docusign 帐户的服务集成。 I began by looking into authentication info and found the Legacy Header page.我首先查看身份验证信息并找到了Legacy Header页面。 This advises against using it for service integrations这建议不要将其用于服务集成

Legacy Header authentication was formerly recommended for service integrations. Legacy Header 身份验证以前建议用于服务集成。 DocuSign recommends new service integrations be built with Service Integration Authentication. DocuSign 建议使用服务集成身份验证构建新的服务集成。

So I decided to go to that Service Integration Authentication page which states所以我决定去那个服务集成身份验证页面

Before an application can impersonate a user, the application must get consent directly from the user or from their account administrator.在应用程序可以模拟用户之前,应用程序必须直接获得用户或其帐户管理员的同意。

Then in the granting consent section it states然后在授予同意部分说明

User consent can start with either the Authorization Code Grant or the Implicit Grant.用户同意可以从授权代码授予或隐式授予开始。

However, both the Authorization Code Grant and the Implicit Grant pages state at the very top of the page但是, 授权代码授予隐式授予页面都在页面的最顶部说明

This grant is not suitable for service integrations.此赠款不适用于服务集成。

So should I not use these grants?那么我不应该使用这些赠款吗? If I don't it leaves me back at using Legacy Header authentication.如果我不这样做,它会让我回到使用旧版标头身份验证。 I have no problem with this but why advise against using it then advise against using the alternative as well?我对此没有问题,但为什么建议不要使用它然后建议不要使用替代方案? Am I missing something?我错过了什么吗?

I'm sorry that the documentation for Service Integrations is not clear.很抱歉,服务集成的文档不清楚。 We will work to improve it.我们将努力改进它。

TL;DR -- watch my screencast where I focus on this exact issue. TL;DR - 观看我专注于这个确切问题的截屏视频

Here's the scoop:这是独家新闻:

The JWT flow is recommended for Service Integrations if you're writing the app for your own organization's use.如果您正在编写应用程序供您自己的组织使用,则建议将 JWT 流程用于服务集成。 If you're an ISV (if you'll be selling your software to DocuSign customers) then there are additional issues to be considered at this time.如果您是 ISV(如果您将向 DocuSign 客户销售您的软件),那么此时还有其他问题需要考虑。

To use the JWT flow and impersonate someone or a designated "system user" (the usual cases) then your app needs permission to do so.要使用 JWT 流程并模拟某人或指定的“系统用户”(通常情况下),您的应用程序需要这样做的权限。 If you have Organization Admin enabled, your org admin can proactively grant permission for your app to impersonate anyone in your org.如果您启用了组织管理员,您的组织管理员可以主动授予您的应用程序权限以模拟组织中的任何人。

You can also have each person individually grant permission.您还可以让每个人单独授予权限。 Eg, you create a user called "HR Dept" in DocuSign.例如,您在 DocuSign 中创建了一个名为“HR Dept”的用户。 You then login as the "HR Dept" and grant permission to the app to impersonate the "HR Dept."然后,您以“人力资源部”的身份登录并授予应用程序权限以冒充“人力资源部”。

A user grants permission to an app the first time they use it.用户在首次使用应用程序时授予该应用程序的权限。 But user's don't "use" Service Integrations!但是用户不要“使用”服务集成! (As you discovered via the documentation.) (正如您通过文档发现的那样。)

Here's the trick: Set up the app in DocuSign as both a Auth Code Grant app (set a redirect URI) and as a JWT flow app (create a public/private key pair).诀窍如下:将 DocuSign 中的应用程序设置为 Auth Code Grant 应用程序(设置重定向 URI)和 JWT 流应用程序(创建公钥/私钥对)。 For convenience, set the redirect URI to an existing site.为方便起见,将重定向 URI 设置为现有站点。 Eg, https://www.docusign.com例如, https://www.docusign.com

Then, once per user who will be impersonated, tell them to enter a specific URL into their browser.然后,对于每个将被模拟的用户,告诉他们在浏览器中输入一个特定的 URL。 That URL is the first leg of the OAuth Auth Code Grant flow.该 URL 是 OAuth 身份验证代码授予流程的第一站。 It is它是

${AUTHENTICATION_URL}/oauth/auth?response_type=code&scope=${encoded_scopes}&client_id=${CLIENT_ID}&redirect_uri=${REGISTERED_REDIRECT_URI}`

# AUTHENTICATION_URL = https://account-d.docusign.com  (demo)
# AUTHENTICATION_URL = https://account.docusign.com  (production)
# CLIENT_ID = your integration key
# encoded_scopes = signature%20impersonation
# REGISTERED_REDIRECT_URI = https://www.docusign.com (or whatever
#                            you registered)

When the user enters the above url, DocuSign will ask them to log in and then ask them to grant the permissions (scopes) to your app.当用户输入上述 url 时,DocuSign 将要求他们登录,然后要求他们向您的应用授予权限(范围)。

Then you can run your JWT flow (no user required) and you're golden.然后你可以运行你的 JWT 流程(不需要用户),你就是金子。

Added: Granting Consent is one time per user per integration key添加:每个用户每个集成密钥一次授予同意

Granting consent is a one time operation per user per integration key.授予同意是每个用户每个集成密钥的一次性操作。 So once your user(s) have granted consent, your application can keep re-running the JWT grant flow.因此,一旦您的用户同意,您的应用程序就可以继续重新运行 JWT 授权流程。

Caveats:注意事项:

  • Only use the JWT grant flow when your app needs a new access token for the user being impersonated.仅当您的应用程序需要被模拟用户的新访问令牌时,才使用 JWT 授权流程。 Don't use the JWT grant flow before each API call!不要在每次 API 调用之前使用 JWT 授权流程! Only use the flow when the existing access token has expired or is about to expire.仅在现有访问令牌已过期或即将过期时使用该流。

  • If the user revokes consent to your app then your app will need to acquire consent again.如果用户撤销对您的应用的同意,则您的应用将需要再次获得同意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM