사용자가 양식을 완성한 후에 DocuSign 내장 서명 REST API를 사용하여 DocuSign에 삽입 된 문서가있는 탭을 열어주는 AngularJS 응용 프로그램이 있습니다.AngSJS가 포함 된 XSRF : DocuSign API 클라이언트 측 구현
몇 가지 주제에 대해 StackOverflow를 둘러 보았지만 구현과 관련하여 아무 것도 찾을 수 없습니다.
나는 로그인 할 때 401 오류가 계속 발생하며 CORS가 차단되어 있기 때문에 그럴 것이라고 확신합니다. 도움을 주시면 감사하겠습니다. 여기
내 DocuSign의 공장 :app.factory('dsFactory', function($http) {
return {
login: function(templateId) {
return $http({
url: 'https://demo.docusign.net/restapi/v2/login_information',
method: 'GET',
params: {
'X-DocuSign-Authentication': {
'DocuSignCredentials': {
'UserName': 'xxx',
'Password': 'xxx',
'IntegratorKey': 'xxx'
}
}
}
});
},
envelope: function(baseUrl, templateId, recipientName, templateRoleName) {
var url = baseUrl + "/envelopes";
return $http({
url: url,
method: 'POST',
params: {
"emailSubject": "DocuSign API call - Embedded Sending Test",
"templateId": templateId,
"templateRoles": [{
"email": "xxx",
"name": recipientName,
"roleName": templateRoleName
}],
"status": "sent"
}
});
},
getUrl: function(baseUrl, envelopeId, recipientName) {
var url = baseUrl + "/envelopes/" + envelopeId + "/views/recipient";
return $http({
url: url,
method: 'POST',
params: {
"returnUrl": "http://www.docusign.com/devcenter",
"authenticationMethod": "email",
"email": "xxx",
"userName": recipientName
}
});
}
};
});
그리고 여기에 포함 된 문서보기로 새 탭을 열 수있는 약속 체인입니다 : 내가 얻을 수있는 방법에
// Elaborate promise chain for DocuSign login and document url retrieval
loginPromise = dsFactory.login($scope.templateId);
loginPromise.then(
function(payload) {
$scope.dsBaseUrl = payload.data.loginAccounts[0].baseUrl;
envelopePromise = dsFactory.envelope($scope.dsBaseUrl, $scope.templateId, $scope.businessName, 'Signer');
envelopePromise.then(
function(payload) {
$scope.dsEnvelopeId = payload.data.envelopeId;
urlPromise = dsFactory.getUrl($scope.dsBaseUrl, $scope.dsEnvelopeId, $scope.businessName);
urlPromise.then(
function(payload) {
$scope.dsCompleteUrl = payload.data.returnUrl;
window.open($scope.dsCompleteUrl);
},
function(errorPayload) {
console.log('retrieve DS url failed' + '\n');
console.log('Status: ' + errorPayload.status);
}
);
},
function(errorPayload) {
console.log('retrieve DS envelopeId failed' + '\n');
console.log('Status: ' + errorPayload.status);
}
);
},
function(errorPayload) {
console.log('DS login failed' + '\n');
console.log('Status: ' + errorPayload.status);
}
);
어떤 생각 또는 지원 이 통합 작업?
어쩌면 헤더와 관련이 있을까요?
당신이 제대로 통합 키를 보호 할 수있는, # 1, 고려하십시오. # 2를 사용하면 해당 키를 서버 쪽에서 유지하고 누출되지 않도록 할 수 있습니다. –