question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

400 error when inserting SMimeInfo

See original GitHub issue

Hello - I’m having some trouble updating S/MIME for a user via the .NET SDK for Gmail, every attempt results in a 400 Bad Request response. I’m attempting to implement this from PowerShell as part of my module, PSGSuite, but have not had much luck with this particular API. Issue tracking this in that repo: https://github.com/scrthq/PSGSuite/issues/57

Checking through the documentation and source code for various SDK languages as well as the REST API itself isn’t too helpful, as it appears the .NET SDK is the only language that is expecting a String type for the Pkcs12 property on the SmimeInfo body object, everything else expects the certificate bytes. Attempting to pass in the byte array works, but implicitly casts it to a single string, which results in a 400 Bad Request. I’ve also attempted to convert to both Base64 and URLSafeBase64, those fail with the same 400 error.

Should the Pkcs12 property on the SMimeInfo object be expecting a Byte[] type instead of String? Is there something I’m doing wrong here?

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
jskeetcommented, Jan 2, 2020

Right, I’ve now consulted with a colleague, and we agree that the URL-safe encoding (without trimming) is likely to work. That would match other behavior in the gmail API which is documented, e.g. here for the “raw” field: https://developers.google.com/gmail/api/v1/reference/users/messages#resource

If you could confirm that it works for you when you’re able to do so, we can try to get the documentation amended to make it clear using the same wording as for Message.raw. Thanks!

1reaction
jskeetcommented, Dec 30, 2019

Maybe - all the reference documentation is auto-generated, so I’ll need to work out how to phrase it properly in a cross-platform way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pushing SMIME cert to users in Google work space using ...
I have tried to follow the API documentation but I am not sure what I am doing wrong, I have a deception error...
Read more >
Method: users.settings.sendAs.smimeInfo.insert | Gmail
Insert (upload) the given S/MIME config for the specified send-as alias. Note that pkcs12 format is required for the key.
Read more >
What is a Bad Request Error 400 and How Do You Fix It?
People can deal with a slew of errors when using the internet. In this post, we will talk about error 400, one of...
Read more >
Google BigQuery Connector | 400 error while invoking ...
BigQuery Connector "Query" Operation is failing with the 400 error when it tries to execute an insert statement with a simple row.
Read more >
"Bad Request Error 400" when installing add-ons
I have been trying to install my add-on from the Workspace Marketplace for nearly a week now but after clicking "CONTINUE", the following ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found