Our Community is in read-only mode until April 8th, learn more here. You can still search existing threads or get help via Dropbox Support, the Dropbox Help Center, or Learn.
Forum Discussion
rostyslavpopov
1 year agoExplorer | Level 4
Missing parameter: client_id for lwc
Im working on a lwc where id like to embed a signing process in iframe, I was able to successfully retrieve sign URL, but when I try to use it on iframe I got following error, at which step do I need to set my client id?
So far I used this with client id in request body
String apiUrl = 'https://api.hellosign.com/v3/signature_request/create_embedded_with_template';
and
request.setEndpoint('https://api.hellosign.com/v3/embedded/sign_url/' + signatureId);
with just signature id in request body
Also I have a problem setting body for my request, I used this class to generate json string, but when I use this approach I get error({"error":{"error_msg":"No template_id or template_ids specified","error_path":"template_id","error_name":"bad_request"}})
HelloSignJSON.Signing_options so = new HelloSignJSON.Signing_options();
so.default_type = 'draw';
so.draw = true;
so.phone = true;
so.type = true;
so.upload = true;
HelloSignJSON.Signers signer = new HelloSignJSON.Signers();
signer.role = 'Lead.Customer';
signer.name = 'Rostyslav';
signer.email_address = 'popov.rst@gmail.com';
List<HelloSignJSON.Signers> signers = new List<HelloSignJSON.Signers>{signer};
HelloSignJSON hsj = new HelloSignJSON();
hsj.template_ids = new List<String>{'90c43afee504f24a2dcd67ab7991f8f3f5900ef3'};
hsj.client_id = 'CLIENT_ID';
hsj.subject = 'Embedded Subject';
hsj.message = 'Embedded message';
hsj.signing_options = so;
hsj.test_mode = true;
hsj.signers = signers;
String requestBody = JSON.serialize(hsj);
17 Replies
Replies have been turned off for this discussion
- DB-Des1 year ago
Dropbox Community Moderator
It appears as though the JSON serialization process in your code is producing an unexpected result — the List<String> is somehow being serialized into a JSON object rather than a JSON array, which is what the API expects.
We would recommend reviewing your code to ensure the template IDs are being sent in an array and not a JSON object.
- rostyslavpopov1 year agoExplorer | Level 4
and what about the first problem with missing client id? I figured out that I can put client id into URL and it will work, but this is not secure, right? So I need to know how to make it secure
- DB-Des1 year ago
Dropbox Community Moderator
If the Client ID is a required parameter for the endpoint(s) you are using, it must be included to ensure proper functionality.
Including the Client ID in your requests is both standard practice and safe. The Dropbox Sign API is designed with robust security measures in place to protect data and ensure the integrity of all interactions. Rest assured, we wouldn’t request this information if it posed a security risk.
- eappsiadvancenow1231 year agoNew member | Level 1
DB-DesI'm passing the following request but still I'm getting the same error:
{"client_id":"MY_CLIENT_ID","template_ids":["xyz"],"signers":"[{"role":"Lead","name":"Test Template","email_address":"test@mycompany.com"}]"}
the above request has template_ids in JSON array format only but still the API response is {"error":{"error_msg":"No template_id or template_ids specified","error_path":"template_id","error_name":"bad_request"}} - eappsiadvancenow1231 year agoNew member | Level 1
rostyslavpopovHow did you escape from this issue?
- rostyslavpopov1 year agoExplorer | Level 4
Yes, using apex approach i needed to modify URL by placing client id as first or last URL argument. But I switched to JS SKD approach and its easier in there and provides better user experience
- DB-Des1 year ago
Dropbox Community Moderator
It would appear as though the payload request you are sending to the API is not being formed properly. Could you please share a full code snippet of the code being used to generate the payload request? As well as the language, SDK, or library being used to generate and send the request.
- rostyslavpopov1 year agoExplorer | Level 4
ur not passing the email template
if your endpoint is:String apiUrl = 'https://api.hellosign.com/v3/signature_request/create_embedded_with_template';Then you should paste your template id which you can get on hellosign.
I wasn't able to use an apex class that I can later serialize and use as request body, It would throw same error as you shown for me, not sure why because template id was in there, here's what i used:String requestBody = 'client_id=' + EncodingUtil.urlEncode(clientId, 'UTF-8') + '&template_ids[]=' + EncodingUtil.urlEncode(templateId, 'UTF-8') + '&subject=' + EncodingUtil.urlEncode('Purchase Order', 'UTF-8') + '&message=' + EncodingUtil.urlEncode('Glad we could come to an agreement.', 'UTF-8') + '&signers[0][role]=' + EncodingUtil.urlEncode('Lead.Customer', 'UTF-8') + '&signers[0][name]=' + EncodingUtil.urlEncode(Lead.Name, 'UTF-8') + '&signers[0][email_address]=' + EncodingUtil.urlEncode(email, 'UTF-8');This is annoying to add new fields into, as it would be in form of:
if (!String.isEmpty(lead.Email)) { requestBody += '&custom_fields[0][name]=Lead.Email&custom_fields[0][value]=' + EncodingUtil.urlEncode(lead.Email, 'UTF-8'); } if (!String.isEmpty(lead.Company)) { requestBody += '&custom_fields[1][name]=Lead.Company&custom_fields[1][value]=' + EncodingUtil.urlEncode(lead.Company, 'UTF-8'); }etc, but i believe you can try to use another class for your custom fields and then add its serialized part to the body from previous sample, i think it would be a more convenient approach although i didn't try it.
Are you implementing this for apex lwc? If so you can reach out to me through email and ill be able to provide answers with more details! - eappsiadvancenow1231 year agoNew member | Level 1
rostyslavpopovThank you so much for your help here! I was able to get the sign url successfully.
Probably one last question, how are you opening embedded window on your site? When I'm trying to open it in incognito window by appending client_id in url, it gives me this error(attached screenshot).
I have provided "my.salesforce-sites.com" under Domain in my App.
Your help in this is very much appreciated!
- rostyslavpopov1 year agoExplorer | Level 4
can you provide more details on what are you trying to achieve please?
About Dropbox Sign API
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!