sanjayadvisie

Exception "Could not create a new package one step"

0 votes
Hi, I am getting the exception. Exception "Could not create a new package one step: Object reference not set to an instance of an object". I am on .NET version 4.7 and Newtonsoft 12. On debugging I can see that the error occurs in the call to ESLClient.CreatePackageOneStep(_vsdocpackage); Also this exception occurs only when the first call to ESLClient.CreatePackageOneStep(_vsdocpackage) is made. All subsequent calls to ESLClient.CreatePackageOneStep(_vsdocpackage) work fine. Note my ESLClient instance is not static and I am instantiating a new instance of ESL client for creating every package.

Reply to: Exception "Could not create a new package one step"

0 votes
Hi Thaban, Can you create the package with hardcoded information(with reading from XML)?
 EslClient eslClient = new EslClient(apiKey, apiUrl);
            DocumentPackage package = PackageBuilder
              .NewPackageNamed("Test Package .NET")
                    .WithSigner(SignerBuilder
                         .NewSignerWithEmail("[email protected]")
                                .WithFirstName("Signer First Name")
                                .WithLastName("Signer Last Name")
                                .WithCustomId("Signer"))
                    .WithDocument(DocumentBuilder.NewDocumentNamed("testpdf.pdf")
                                     .FromStream(File.OpenRead("your file path"), DocumentType.PDF)
                                  .WithId("testpdf.pdf")
                                  .WithSignature(SignatureBuilder
                                       .SignatureFor("[email protected]")
                                         .OnPage(0)
                                         .AtPosition(200, 300)
                                         .WithField(FieldBuilder.SignatureDate().OnPage(0).AtPosition(200, 400))
                                         )
                    )
                    .Build();

            PackageId pkgid = eslClient.CreatePackageOneStep(package);
Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Exception "Could not create a new package one step"

0 votes
No. I get the same error.

Reply to: Exception "Could not create a new package one step"

0 votes
Hi Thaban, How about the TLS version? OneSpan Sign has dropped support for TLS 1.0 so could that be an issue to you? What's your .Net version? Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Exception "Could not create a new package one step"

0 votes
Hi, I am running this on latest Windows 10 under .NET 4.5 project. I think the latest TLS is supported under this. Also, I am running the latest eSign SDK. I did have trouble using the Newtonsoft JSON that came with eSign SDK. I have to use the v11.00 which I downloaded from Newstonsoft website. Thaban

Reply to: Exception "Could not create a new package one step"

0 votes
Hi Thaban, Thanks for reporting the Newtonsoft version to us! It's a known issue already. And for the null pointer issue, can you try this function:
var appVersion = eslClient.SystemService.GetApplicationVersion();
This is the most basic function we suggest to use testing connection with OneSpan Sign, and if this works, it means your connection (proxy or tls related issue) with OSS is fine. And thanks again! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Exception "Could not create a new package one step"

0 votes
Hi, I switched the project to NET 4.6 and this has resolved that issue. Could have been the TLS. Again, thanks for all your help. Thaban

Reply to: Exception "Could not create a new package one step"

0 votes
Glad to hear that! Just let us know if you have any other issues! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Exception "Could not create a new package one step"

0 votes

Hi there, Below are some questions and thinking trying to understand the pattern of the issue: (1)Is it always the first call communicating to OneSpan Sign of the session or of the first start of the server/local code? What if you pre-invoked a dummy call like:

string applicationVersion = eslClient.SystemService.GetApplicationVersion();

(2)Can you try to connect to another network to see if it's a network problem? (3)Are you connecting through proxy? If that's the case, there was a post before indicating that this issue may be solved by introducing below configurations to the App.config:

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Exception "Could not create a new package one step"

0 votes

Hi 

I am also getting same issue in creating prototype sample 

OneSpanSign.Sdk.OssException: 'Could not create a new package one step. Exception: Object reference not set to an instance of an object.'

NullReferenceException: Object reference not set to an instance of an object.
 

OssClient ossClient = new OssClient(API_KEY, API_URL);

FileStream fs = File.OpenRead(documentId);

 DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("Test Package .NET")
                    .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings())

.....

 

 PackageId packageId = ossClient.CreatePackageOneStep(superDuperPackage);

 

When I tried to use this, it is giving below error - 

string applicationVersion = ossClient.SystemService.GetApplicationVersion();

OneSpanSign.Sdk.OssServerException: 'Could not get application version. Exception: The remote server returned an error: (401) Unauthorized. HTTP GET on URI https://sandbox.esignlive.com/api/sysinfo. Optional details: {"messageKey":"error.unauthorised.noSession","message":"Failed to retrieve Session","code":401,"name":"Unauthorized"}'
 

OssServerException: The remote server returned an error: (401) Unauthorized. HTTP GET on URI https://sandbox.esignlive.com/api/sysinfo. Optional details: {"messageKey":"error.unauthorised.noSession","message":"Failed to retrieve Session","code":401,"name":"Unauthorized"}
 

Shyam


Reply to:

0 votes

Hi Shyam,

 

As the .GetApplicationVersion() function returns unauthorized error, could we double check if the API Key is the same as what you found from sender portal? - Log onto your account owner's sender portal (e.g. https://sandbox.esignlive.com/a/login), expand the "Admin" tab and select "API Access", you'll find API Key there.

Back to the error itself, from my experience, the Null pointer error during package creation typically caused by TLS version incompatible. Which .NET framework/core version are you developing with? Could you have a quick try by explicitly specifying the TLS version with this line:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 //TLS 1.2

Let me know if this works for you.

 

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to:

0 votes

Thanks Duo, it is executed and that file in sandbox. 

ossClient.SendPackage(packageId);

I have few questions - 

1- How I can view that document in new tab? Just after clicking a event from UI - Ui call api and that method is executed.

2. Signers are not notified with email, how to notify them? 

3. When they click any link from email it shd open that document. 

 

Thanks

Shyam

Shyam


Reply to:

0 votes

Hi Shyam,

 

Great to hear that! Per your questions:

(1)"view that document in new tab"

Not sure which document you meant, if you meant to review the created package, you could either embed a designer view (check my blog here), or a transaction edit page (check my blog here)

On the other hand, if you meant to open the signing ceremony link in a new tab, then you'd either build a signing link, or a link with authentication token.

 

(2)signers are not notified with email

Could you provide the package ID of it?

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Exception "Could not create a new package one step"

0 votes

Hi Duo, 

Thanks, I am able to open in new tab but blank, how can I view that document (Details_001_20210426_184456PM.pdf) which require sign? 

documentPath = @"D:\Details_001_20210426_184456PM.pdf"

FileStream fs = File.OpenRead(documentPath); 

PackageId - g-m1MPcRcHb8V2f3ecpvKKoPHTA=

now I am trying to fetch GetSigningUrl

//string signingUrl = ossClient.PackageService.GetSigningUrl(package, signerId);

Could not get a signing url. Exception: The remote server returned an error: (403) Forbidden. HTTP GET on URI https://sandbox.esignlive.com/api/packages/xxxxxxxxxxxxxxxxxx=/roles/Signer1/signingUrl. Optional details: {"technical":"Cannot access a package that can be edited xxxxxxxxxxxxx=","messageKey":"error.forbidden.cannotAccessEditablePkg","message":"Cannot access an editable package.","code":403,"name":"Access Denied"}

//string signerAuthToken = ossClient.AuthenticationTokenService.CreateSignerAuthenticationToken(new PackageId(package.Id), signerId);

This package is in an invalid state for requested action.

Could not create a signer authentication token. Exception: The remote server returned an error: (400) Bad Request. HTTP POST on URI https://sandbox.esignlive.com/api/authenticationTokens/signer/multiUse. Optional details: {"messageKey":"error.validation.packageManagement.invalidState","message":"This package is in an invalid state for requested action.","code":400,"name":"Validation Error"}


//string singleUseToken = ossClient.AuthenticationTokenService.CreateSignerAuthenticationTokenForSingleUse(package, signerId, signerSessionFields);

Here what will be signer session fields here?

 

Thanks

Shyam

 

 

 

 

Shyam


Attachments

Reply to:

0 votes

Hi Shyam,

 

For this package g-m1MPcRcHb8V2f3ecpvKKoPHTA=, it's in SENT status now, however, as per the error message "Cannot access an editable package." and "This package is in an invalid state for requested action.", I think the package was still DRAFT when you invoked the .GetSigningUrl() and .CreateSignerAuthenticationToken() calls.

Could you double check if you've sent the package with this code prior to generating the signing url? - ossClient.SendPackage(packageId);

On the other hand, from the screenshot you provided, you are also sending package from designer page. Not sure what is your exact workflow, but this might cause the conflict regarding to the package status:
- you can only view designer view when package in DRAFT status

- you can only generate signing link / authentication token when package in SENT status

- in order to monitor the send action in designer view, I would suggest you to either embed the designer in an iFrame with the "SEND" button hidden and provide a custom button outside of it, or open the designer view in a new tab, or let the preparer close the tab in order to continue the flow. I've given two examples in these guides:
https://www.onespan.com/blog/onespan-sign-developer-designer-customization-and-integration-part-3

https://www.onespan.com/blog/onespan-sign-developer-designer-customization-and-integration-part-4

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to:

0 votes

Hi Duo

Thanks, I will follow those. 

I want to achieve this - From Code I will send path of my document(d:shyam_agreement.pdf) to OneSpan with Signatories (A,B,C,D along with email id) naming it template. It will create package and form texbox where need to put sign once package will create it will notify all users(A,B,C,D) if flow is parallel, if flow is sequence only to A.

Now A will come to my application with proper login - I will provide a link to sign that document, on that link, I want to open a page(d:shyam_agreement.pdf with sign texbox) in new tab. It can open that in onespan or in my application (1st preference). 

A will sign or reject, it will notify others and send a result to my application in response. 

Once that flow in complete, I want to download that signed document in my local for further reference. 

My users (A,B,C,D) will not check or login in OneSpan, they will click and view document. When they will click through email it will open direct OneSpan and when they will click through my application, it will open new page in my application in new tab.

It will be great if you share any doc sdk for such flow or provide steps. 

Every time it is creating a new Transaction name so there Transaction name mean document sent for signing?

Hope I am able to clear my flow. 

 

Thanks

Shyam

 

Shyam


Reply to:

0 votes

Hi Shyam,

 

Below are some of my comments and suggestions regarding to your workflow:

 

"From Code I will send path of my document(d:shyam_agreement.pdf) to OneSpan with Signatories (A,B,C,D along with email id) naming it template. It will create package and form texbox where need to put sign."

This regards to the package creation, if you have any further questions about which field type to use, or how to put signatures or fields, please let me know.

 

"once package will create it will notify all users(A,B,C,D) if flow is parallel, if flow is sequence only to A."

This is exactly how signing order works in OneSpan Sign - you'd specify an index for signers.

 

"Now A will come to my application with proper login - I will provide a link to sign that document, on that link, I want to open a page(d:shyam_agreement.pdf with sign texbox) in new tab. It can open that in onespan or in my application (1st preference). "

I've covered how to generate a signing link above. However the tricky part is, the out-of-the-box email notification sent the the recipient contains the signing link already, while you want the signer to come to your application first. To achieve this, you will need to contact support team ([email protected]) and customize the default email templates. I have a blog series which might be helpful if you are not familiar with email templates in OneSpan Sign:

https://www.onespan.com/blog/onespan-sign-developers-email-templates-part-1

https://www.onespan.com/blog/onespan-sign-developers-email-templates-part-2

https://www.onespan.com/blog/onespan-sign-developers-email-templates-part-3

To be more specific, you will need to replace the default signing link (it's a placeholder $LINK_URL;) with the login URL of your application.

 

 

"A will sign or reject, it will notify others and send a result to my application in response. Once that flow in complete, I want to download that signed document in my local for further reference. "

In order to notify your application about the status change, you probably want to set up a callback listener, check the guide here.

To notify other signers, this documentation lists all the available email templates, however I believe there's only completion email which get triggered when all signers has completed signing, not for decline. (email.decline only sends to sender)

 

"My users (A,B,C,D) will not check or login in OneSpan, they will click and view document. When they will click through email it will open direct OneSpan and when they will click through my application, it will open new page in my application in new tab."

The default completion email includes the signing link. For your application, again, you will need to generate/store the signing link and open it in a new tab.

 

 

"Every time it is creating a new Transaction name so there Transaction name mean document sent for signing?"

Every time when your application invoked the ossClient.CreatePackage() function, it creates a new transaction at OneSpan Sign system. (typically, functions under OssClient class communicates with OneSpan Sign system, simply building a DocumentPackage object in your local won't have it synchronize with server)

Also, package ID is unique within each environment (e.g. https://sandbox.esignlive.com), while Transaction name doesn't necessary to be unique.

 

Hope these answer your questions.

 

Duo

 

 

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to:

0 votes

Hi Duo

Thanks for quick response, now I making step by step 

- Creating document package

Error - Could not send the package. Exception: The remote server returned an error: (400) Bad Request. HTTP POST on URI https://sandbox.esignlive.com/api/packages/NfLxVMo7zVbdOBc1AWJw-Qa1WcI=. Optional details: {"messageKey":"error.validation.sendPackage.noApprovals","message":"Cannot send package without approvals.","code":400,"name":"Validation Error"}

and when I am using my email it is showing this message but it is first in signer, in every transaction it is also adding my email id in Signor list who create that account.

{"messageKey":"error.validation.userAddition.duplicateEmailUsage","message":"The email is already in use for this package.","code":400,"name":"Validation Error"}'
 

Here is code snippet 

public List<PackageDto> InitiateESign(int recordId, List<ESignDto> eSignDtos)
        {
            OssClient ossClient = new OssClient(API_KEY, API_URL);
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //TLS 1.2

            List<PackageDto> packageDtos = new List<PackageDto>();
            foreach (var item in eSignDtos)
            {
                PackageDto packageDto = new PackageDto();

                FileStream fs = File.OpenRead(item.DocumentPath);
                string packageName = item.DocumentName + "_" + item.FeatureId + "_" + item.RecordNumber + "_" + item.RecordId;
                              

                DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed(packageName)
                        .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings())                                    
                        .Build();

                PackageId package = ossClient.CreatePackageOneStep(superDuperPackage);
                

                List<SignerDto> signers = item.Signer;
                for (int i = 0; i < item.Signer.Count; i++)
                {
                    SignerDto tempSigner = new SignerDto();
                    tempSigner = item.Signer[i];

                    Signer signer = SignerBuilder.NewSignerWithEmail(tempSigner.Email)
                        .WithFirstName(tempSigner.FirstName)
                        .WithLastName(tempSigner.LastName)
                        .WithCustomId(i.ToString()).SigningOrder(tempSigner.Order)
                        .Build();
                    tempSigner.SignerId = ossClient.PackageService.AddSigner(package, signer);

 

// please suggest how to incorporate this also

                    //Signature signature = SignatureBuilder.SignatureFor(tempSigner.Email)
                    //  .OnPage(0)
                    //  .AtPosition(215, 510)
                    //  .WithSize(200, 50)
                    //  .WithId(new SignatureId("signature1"))
                    //  .Build();
                    //ossClient.ApprovalService.AddApproval(package, documentId, signature);

                    //tempSigner.SigningUrl = ossClient.PackageService.GetSigningUrl(package, tempSigner.SignerId);
                    //tempSigner.SignerAuthToken = ossClient.AuthenticationTokenService.CreateSignerAuthenticationToken(new PackageId(package.Id), tempSigner.SignerId);

                    //signers.Add(tempSigner);
                }
                ossClient.SendPackage(package);

                for (int i = 0; i < item.Signer.Count; i++)
                {
                    SignerDto tempSigner = new SignerDto();
                    tempSigner = item.Signer[i];
                    tempSigner.SigningUrl = ossClient.PackageService.GetSigningUrl(package, tempSigner.SignerId);
                    tempSigner.SignerAuthToken = ossClient.AuthenticationTokenService.CreateSignerAuthenticationToken(new PackageId(package.Id), tempSigner.SignerId);

                    signers.Add(tempSigner);
                }

                packageDto.Signer = signers;              
                packageDto.PackageId = package.Id;
                packageDto.DocumentPath = item.DocumentPath;
                packageDto.DocumentName = item.DocumentName;
                packageDto.DocumentId = item.DocumentId.ToString();
                packageDtos.Add(packageDto);
            }


            return packageDtos;
        }

Am I missing any point or making it in wrong way.

How to add SignatureBuilder dynamic per signatory 
like Signor1 - page (0) position ( bottom of page) 
Signor 2 - page (0) position(bottom of page but below signor1), please revert as I need to close this sample prototype today. 

 

Shyam


Reply to:

0 votes

Hi Shyam,

 

Please review and try using this code instead, changes are mainly around the lines I've highlighted (and now, all signatures are with hardcoded position):

 

public List<PackageDto> InitiateESign(int recordId, List<ESignDto> eSignDtos)
        {

            OssClient ossClient = new OssClient(API_KEY, API_URL);
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //TLS 1.2

            List<PackageDto> packageDtos = new List<PackageDto>();
            foreach (var item in eSignDtos)
            {

                PackageDto packageDto = new PackageDto();


                string packageName = item.DocumentName + "_" + item.FeatureId + "_" + item.RecordNumber + "_" + item.RecordId;
                        
                PackageBuilder pb = PackageBuilder.NewPackageNamed(packageName)  
                        .WithStatus(DocumentPackageStatus.SENT)     
                        .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings());

                DocumentBuilder db = DocumentBuilder.NewDocumentNamed("Document1")
                    .FromFile(item.DocumentPath);


                List<SignerDto> signers = item.Signer;
                for (int i = 0; i < item.Signer.Count; i++)
                {
                    SignerDto tempSigner = new SignerDto();
                    tempSigner = item.Signer[i];

                    SignerBuilder sb = SignerBuilder.NewSignerWithEmail(tempSigner.Email)
                        .WithFirstName(tempSigner.FirstName)
                        .WithLastName(tempSigner.LastName)
                        .WithCustomId(i.ToString()).SigningOrder(tempSigner.Order);

                    pb.WithSigner(sb);

                    SignatureBuilder signatureBuilder = SignatureBuilder.SignatureFor(tempSigner.Email)
                                                        .OnPage(0)
                                                        .AtPosition(215, 510)
                                                        .WithSize(200, 50)
                                                        .WithId(new SignatureId("signature1"));
                    db.WithSignature(signatureBuilder);

                    signers.Add(tempSigner);
                }

                pb.WithDocument(db);
                PackageId package = ossClient.CreatePackageOneStep(pb.build());

  


                for (int i = 0; i < item.Signer.Count; i++)
                {
                    SignerDto tempSigner = new SignerDto();
                    tempSigner = item.Signer[i];
                    tempSigner.SigningUrl = ossClient.PackageService.GetSigningUrl(package, tempSigner.SignerId);
                    tempSigner.SignerAuthToken = ossClient.AuthenticationTokenService.CreateSignerAuthenticationToken(new PackageId(package.Id), tempSigner.SignerId);

                    signers.Add(tempSigner);
                }

                packageDto.Signer = signers;              
                packageDto.PackageId = package.Id;
                packageDto.DocumentPath = item.DocumentPath;
                packageDto.DocumentName = item.DocumentName;
                packageDto.DocumentId = item.DocumentId.ToString();
                packageDtos.Add(packageDto);
            }

            return packageDtos;
        }

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to:

0 votes

Hi Duo

I am getting this error as SignerId is null or empty

Could not get a signing url. Exception: The remote server returned an error: (404) Not Found. HTTP GET on URI https://sandbox.esignlive.com/api/packages/fhSnGjtIWQR0ZBxIfTA8Mra9zh8=/roles//signingUrl. Optional details: {"technical":"Could not find the role with uid: signingUrl in package uid: fhSnGjtIWQR0ZBxIfTA8Mra9zh8=","messageKey":"error.notFound.roleNotFound","message":"No role found for specified signer.","code":404,"name":"Resource Not Found"}'
 

Shyam


Reply to:

0 votes

Hi Shyam,

 

I believe this is because the tempSigner.SignerId is null, to work it around, you can use the same custom ID as you specified

                    SignerBuilder sb = SignerBuilder.NewSignerWithEmail(tempSigner.Email)
                        ......
                        .WithCustomId(i.ToString());

 

Duo

 

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to:

0 votes

Hi Duo

Thanks for your reply. 

I have few doubts regarding package / signer / positions 

1. I have only 1 signer with name Signer 1 , why it is showing 2 Signers in design view Transactions using oneSign portal? See attachment Screenshot_1.png

2. How to check Signer already exist for document with same email id?

3. How to place signers on bottom of page with some spaces and on every pages? Screenshot_3. Can I make a table of Signers like as on bottom of page Screenshot_5

4. Can a signer draw his/her own sign and use them?

5. How to use signer timezone? As Signer1 timezone is IST but it is showing GMT? Screenshot_4

6. Once package and signers are created, document signing process is completed with approve or decline, how to notify my application with callback? 

7. Once any signer perform any action, need callback to parent application a callback with action? https://sandbox.esignlive.com/a/admin/eventnotification

8. As account is created by [email protected]

Now [email protected] initiate package along with 2 signers emails - [email protected], [email protected] now whatever action signer1 and signer2 are doing all notification emails are coming to [email protected] But I want all notification to another email like [email protected], can I pass this email for notification as per transactions?
Like I have 3 transactions - 1,2,3 and want to set separate email id for them [email protected] for 1 transaction, [email protected]abc.com for 2 transaction ?

 

 

 

Shyam


Attachments

Reply to:

0 votes

Hi Shyam,

Per your questions:
(1)This is because your transaction sender will be automatically added to the signer list. This behavior can't be changed, but you can hide the sender from the designer view. To do so, add a package level attribute when building your package:

    DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("Example Transaction") 
                                                ......
                                                .WithAttributes(new DocumentPackageAttributesBuilder() 
                                                    .WithAttribute("senderVisible", false) 
                                                  ) 
                                                .Build();  


(2)I believe you need to loop through the signers in a given package and filter by their emails
(3)"How to place signature on every pages", this is a typically use case for Text Tags feature. Because you're probably not sure about the page number, with text tags, it is able to extract dynamic number of signatures/fields depending on the amount of text tags.

If the signer number is undetermined, I would suggest you to create-and-delete: (1)before invoking .CreatePackage() or .CreatePackageOneStep() functions, add a placeholder signer 5 along with the document, (2)delete the signer 5, all signer 5's signatures will be deleted all together  (3)send the transaction.

(4) This is the Capture signature type, see below:
            SignatureBuilder signatureBuilder = SignatureBuilder.CaptureFor("")
                                    .OnPage(0)
                                    .AtPosition(215, 510)
                                    .WithSize(200, 50)
                                    .WithId(new SignatureId("signature1"));
If you decided to use text tags, signature type can be specified by the tag.

(5)I believe the most granular timezone setting is per package. So you'd either have all signers sign in IST, or determine a most appropriate time zone for all signers.

(6)You need to set up a callback listener, check this guide.

(7)This link is just to set up your callback settings (it's part of the sender UI portal). You will need to expose your own callback endpoint URL and specify it there.

(8)If this notifier email is fixed, you can contact support team ([email protected]) and add this email to be CC'd or BCC'd for all notifications
 

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Exception "Could not create a new package one step"

0 votes

Hi,

I am trying to retrieve the signer authentication token to build the SignInUrl to be used in Iframe in our application, which we are working on. 

I am trying to use the approach of creating SignerSession with Signer Authentication Tokens as per the below blogs

1)  Authentication Tokens | OneSpan Community Platform
2)  OneSpan Sign Developer: Session, Authentication Token, and Signing Url – Part2 | OneSpan

Below is the code snippet, I am using

            PackageId packageId = new PackageId("9ZK_9isXgNtETaEjnJLhIn0KjDs=");            

            string signerId = "92d9bc18-61c0-4518-ad54-ee339d94f848";

            var signingUrl = _ossClient.PackageService.GetSigningUrl(packageId, signerId);  // this works fine, I am getting the signinUrl.

            string signerAuthToken = _ossClient.AuthenticationTokenService.CreateSignerAuthenticationToken(packageId, requestObj.SignerId); // doesn't work

            return $"https://sandbox.esignlive.com/access?sessionToken={signerAuthToken}";

I am receiving this exception.

  OneSpanSign.Sdk.OssException: Could not create a signer authentication token. Exception: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
       ---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
         at Newtonsoft.Json.JsonTextReader.ParseValue()
         at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
         at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
         at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
         at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
         at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
         at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
         at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
         at OneSpanSign.Sdk.OssServerException..ctor(String message, String errorDetails, WebException cause)
         at OneSpanSign.Sdk.Internal.HttpMethods.PostHttp(String apiKey, String path, Byte[] content, IDictionary`2 headers)
         at OneSpanSign.Sdk.RestClient.Post(String path, String jsonPayload)
         at OneSpanSign.Sdk.AuthenticationTokenService.CreateSignerAuthenticationToken(PackageId packageId, String signerId, IDictionary`2 fields)
         --- End of inner exception stack trace ---
         at OneSpanSign.Sdk.AuthenticationTokenService.CreateSignerAuthenticationToken(PackageId packageId, String signerId, IDictionary`2 fields)
         at OneSpanSign.Sdk.AuthenticationTokenService.CreateSignerAuthenticationToken(PackageId packageId, String signerId)
         at OneSpanDigital.Controllers.Services.DocumentService.GetSignerUrl(SignerUrlRequest requestObj) in D:\_workarea\OneSpan\OneSpanDigital\OneSpanDigital\Controllers\Services\DocumentService.cs:line 76
         at OneSpanDigital.Controllers.TransactionsController.GetSignerUrl(SignerUrlRequest requestObj) in D:\_workarea\OneSpan\OneSpanDigital\OneSpanDigital\Controllers\TransactionsController.cs:line 109

I is there something I am missing here.  Any assistance would be really helpful.

Also, which is the secure approach, is using session token based URL or signing URL generated from  "PackageService".


- Zakir



 


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off