...
Table of Contents |
---|
How to execute an OAuth API Authentication
Info |
---|
To execute this procedure, you should first guarantee that the client service setup is completed (https://must.atlassian.net/wiki/spaces/SIGNSTASH/pages/688129/Getting+Started#Client-Service-Setup) |
In his walk through we will be referring to the following example, where the client service alias is PRT.505767457-PRT.111222333-e064c8c0-32ad-4dcf-9a76-f7542a5bae15 and the defined client service is test_123_Test_456_!!!
...
Steps:
generate the base64 of the string relative to <client service alias>:<client service password>. In our example it would be PRT.505767457-PRT.111222333-e064c8c0-32ad-4dcf-9a76-f7542a5bae15:test_123_Test_456_!!! (please note the colon sign “:”).
Example using https://www.base64encode.org/ will produce the encoded base64 credential string UFJULjUwNTc2NzQ1Ny1QUlQuMTExMjIyMzMzLWUwNjRjOGMwLTMyYWQtNGRjZi05YTc2LWY3NTQyYTViYWUxNTp0ZXN0XzEyM19UZXN0XzQ1Nl8hISE=
Authenticate your client service with the base64 credential string
Example using curl command (linux command line https://curl.se/docs/manpage.html )
Code Block # Input Command curl --insecure -v -X POST https://staging.must.digital/oauth2/authorization-server/oauth/token -d "grant_type=client_credentials" -H "Authorization: Basic UFJULjUwNTc2NzQ1Ny1QUlQuMTExMjIyMzMzLWUwNjRjOGMwLTMyYWQtNGRjZi05YTc2LWY3NTQyYTViYWUxNTp0ZXN0XzEyM19UZXN0XzQ1Nl8hISE=" # Output Response from service {"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOb24td3MiXSwic2NvcGUiOlsicmVhZCIsIndyaXRlIl0sImV4cCI6MTY1NjQyMTk4OCwianRpIjoiaU1IRWdrTUhySlc1MmVvdDZyaVlxN1gyUWdBIiwiY2xpZW50X2lkIjoiUFJULjUwNTc2NzQ1Ny1QUlQuMTExMjIyMzMzLWEwZjViOGIwLTk3OGUtNDUwMy04OTU4LTZmZTBjYzAyNmZhMCJ9.OfeSMcsHgnFak3fl1I31reu6f8evrVceYa_LA4YeJrsDkHJMiZfie0KnSflteWVYsTvydqteBZC7fd8mPxslIvzn20fwYvCp8OpnBCV0oYEnLuyfYbTmgJltHho7XenLTZXPa3WVQmvh7Jp9WJQWID7iH6qruZOX2iHBNLwNuLGr6R9jv9k7Vy78tjqjm0LlT6KUL41UehWr3hakMSUOlLk8PQIvmsm8MzzQBnFtPre3bsFxXbimg7s-EuzO4JxOFHO9cw2132kV1Q","token_type":"bearer","expires_in":86399,"scope":"read write","jti":"iMHEgkMHrJW52eot6rgA"}
At this point you have successfully retrieved an access token to be used in the API business calls, and that will be expired in 86399 seconds (~24h)
How to apply a visible signature in a PDF file
The visible signature on a PDF file is an option that the client service can request to be applied on a given document. The business API allows the definition of the visible signature to be applied through the usage of the structure SignRequest > documents[i] > signatureInfo > visibleSignatureInfo (https://staging.must.digital/signstash/einvoice-integration-ws/swagger-ui/index.html#/Document%20sign%20service./signDocumentBatchBase64UsingPOST).
...
This identification of the location where the visible signature will be applied can be set in one of the following ways:
SIGN_FIELD: Use a signature field present in the document. The signature field name should be set in the locationValue request attribute.
COORDINATE: Use a coordinate to find the correct document position. Supported format: page=<page_number>,x=<lower_left_x>,y=<lower_left_y>
PLACEHOLDER: Use a placeholder (unique word). System will scan the document for the given placeholder and stop in the first occurrence.
The lower left part of the word will be used as a coordinate to start the drawing of the signature canvas from top/left orientation.
If the placeholder is not found, an error will be thrown and the signature will not be applied. The placeholder value should be set in the locationValue request attribute.
Applying visible signature based on a signature field
Generate your PDF to be signed with a pre-configured signature field. The generation of such PDF is outside the scope of this tutorial, and should be investigated with your PDF generation software provider.
For this example we will use this example PDF which has a signature field with the name “Signature2” (see attachment Test_signature_field.pdf)
As with your typical signature, you’ll need to encode the pdf content in base64 format (see attachment Test_signature_field.b64).
Execute sign request on API using method /signstash/einvoice-integration-ws/api/v0/document/sign/base64/ (see attachment Test_signature_request.txt)
Note that locationType and locationValue attributes describes the type of visible signature to apply.
Code Block "visibleSignatureInfo": { "area": "width=200,height=400", "font": "color=#ea9dd3,size=11", "locationType": "COORDINATE", "locationValue": "page=1,x=200,y=400", "oneOffTemplate": "Digitally Signed by $certificate.getCommonName().", "templateType": "ONE_OFF" }
Signature response will present a document with the signature applied on the defined signature field (see attachment Test_signature_field_signed.pdf).
...
Attachments:
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
Applying visible signature based on a coordinate
Generate your PDF to be signed with a pre-defined area where the signature is to be applied . The generation of such PDF is outside the scope of this tutorial, and should be investigated with your PDF generation software provider.
For this example we will use this example PDF (see attachment Test_coordinate.pdf)
As with your typical signature, you’ll need to encode the pdf content in base64 format (see attachment Test_coordinate.b64).
Execute sign request on API using method /signstash/einvoice-integration-ws/api/v0/document/sign/base64/ (see attachment Test_signature_request.txt)
Note that locationType and locationValue attributes describes the type of visible signature to apply.
Code Block "visibleSignatureInfo": { "area": "width=200,height=400", "font": "color=#ea9dd3,size=11", "locationType": "COORDINATE", "locationValue": "page=1,x=200,y=400", "oneOffTemplate": "Digitally Signed by $certificate.getCommonName().", "templateType": "ONE_OFF" }
Signature response will present a document with the signature applied on the defined signature field (see attachment Test_coordinate_signed.pdf).
...
Attachments:
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
Applying visible signature based on a placeholder
Generate your PDF to be signed with a pre-defined unique word to act as a placeholder that indicates where the visibile signature will begin to be drawn. The generation of such PDF is outside the scope of this tutorial, and should be investigated with your PDF generation software provider.
For better results, it’s advised that the placeholder word be set with a font color the same as the backgound.
For this example we will use this example PDF (see attachment Test_placeholder.pdf)
As with your typical signature, you’ll need to encode the pdf content in base64 format (see attachment Test_placeholder.b64).
Execute sign request on API using method /signstash/einvoice-integration-ws/api/v0/document/sign/base64/ (see attachment Test_signature_request.txt)
Note that locationType and locationValue attributes describes the type of visible signature to apply.
Code Block "visibleSignatureInfo": { "area": "width=200,height=400", "font": "color=#ea9dd3,size=11", "locationType": "COORDINATE", "locationValue": "page=1,x=200,y=400", "oneOffTemplate": "Digitally Signed by $certificate.getCommonName().", "templateType": "ONE_OFF" }
Signature response will present a document with the signature applied on the defined signature field (see attachment Test_placeholder_signed.pdf).
...
Attachments:
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
View file | ||
---|---|---|
|
...
Please consult one of the following topics related to integration and usage of Sign’Stash platform.
Child pages (Children Display) |
---|