我已经在我的应用程序中集成了 docuSign Android SDK 并能够实现嵌入式签名。但它要求客户在签署文件之前登录。作为面向客户的应用程序,我们不希望他们输入组织文档签名凭据。我们如何使用 SDK 方法或其他方式跳过登录或隐式身份验证?
提前致谢!!
我已经在我的应用程序中集成了 docuSign Android SDK 并能够实现嵌入式签名。但它要求客户在签署文件之前登录。作为面向客户的应用程序,我们不希望他们输入组织文档签名凭据。我们如何使用 SDK 方法或其他方式跳过登录或隐式身份验证?
提前致谢!!
在 Android SDK 中,我们提供以下 api 来登录或验证。
使用访问令牌登录:
您可以调用以下 SDK API:
// accessToken - Access Token which authenticates the user
// refreshToken - If the access token can be refreshed, the refresh token. Optional
// expiresIn - The number of seconds from the time the access token was provisioned to when it will expire
try {
DSAuthenticationDelegate docusignAuthDelegate = DocuSign.getInstance().getAuthenticationDelegate();
docusignAuthDelegate.login(accessToken, refreshToken, expiresIn, context,
new DSAuthenticationListener() {
@Override
public void onSuccess(@NonNull DSUser user) {
// TODO: handle successful authentication here
}
@Override
public void onError(@NonNull DSAuthenticationException exception) {
// TODO: handle authentication failure here
}
}
);
} catch (DocuSignNotInitializedException exception) {
// TODO: handle error. This means the SDK object was not properly initialized
}
您可以通过以下方式检索访问令牌:
一个。按照https://developers.docusign.com/platform/auth/jwt/jwt-get-token/中提到的步骤使用 JWT Grant 身份验证
湾。按照https://developers.docusign.com/platform/auth/authcode/authcode-get-token/中提到的步骤使用授权码授予
使用 JWT Grant 身份验证来获取访问令牌需要在您的后端实现,一旦您的服务器使用这种方法从 DocuSign 接收到访问令牌,那么您的服务器需要将该访问令牌和到期时间传递给您的应用程序,您的应用程序可以调用上面提到的带有访问令牌和过期时间的 Android SDK 登录 api。
使用 OAuth 登录:
UI 显示在用户输入凭据的位置。从您的帐户获取 OAuth 客户端 ID/集成密钥、密钥和 redirectUri。(有关如何从您的帐户中检索 clientId、secretKey 和 redirectUri,请参阅https://developers.docusign.com/platform/auth/authcode/authcode-get-token/ )。
在初始化 DocuSign SDk 时,传递这些值,如下所示
DocuSign.init(
context,
clientId,
secretKey,
redirectUri,
DSMode.DEBUG
).setEnvironment(environment)
DSAuthenticationDelegate authenticationDelegate = DocuSign.getInstance().getAuthenticationDelegate();
authenticationDelegate.login(REQUEST_LOGIN, this, new DSAuthenticationListener() {
}
这将打开 OAuth 登录屏幕。输入您的用户名和密码,您应该可以登录。
在您的用例中,您可以使用 SDK“使用访问令牌登录”方法。