Postman error: "Unable to verify the first certificate" when try to get from my .net core API
Asked Answered
S

10

75

I have my brand new .NET Core service with API and I want to get list of items inside it. It's hosted on localhost and I always have this error:

16 ms
Warning: Unable to verify the first certificate
Network
Request Headers
User-Agent: PostmanRuntime/7.26.8
Accept: */*
Postman-Token: e64e10c3-8e3a-4b47-9427-d994e2bdc9fd
Host: localhost:44397
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Request Body
Response Headers
Transfer-Encoding: chunked
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Tue, 19 Ja

n 2021 14:06:14 GMT
Response Body

How to fix it? I disabled/enabled SSL certification but it no helps.

Subchaser answered 19/1, 2021 at 14:10 Comment(6)
forums.ivanti.com/s/article/…Maclaine
@RomanRyzhiy i tried both options but i can't understand option I, just don't understand how to export certificate, i don't have anything mentioned in instruction in that mmc.exeSubchaser
I have suddenly started to get this on my local machine too. In my case all of the settings in the answer below are turned off.Kimbra
Same issue during development localhost https .net.Battlefield
Solved! Postman Version 9.14.6 pops up to disable SSL. On disabling Working fineFelixfeliza
any solutions ? i have disabled all ssl but still same issueDemocratic
S
70

There are 3 places to disable ssl verification:

  1. Request level: make sure it is off

enter image description here

  1. Global level: (Request level will have precedence)

enter image description here

  1. Remove client and CA certificate, turn it to off :

enter image description here

Sik answered 19/1, 2021 at 15:9 Comment(6)
Everywhere you pointed i have turned off SSL certificate and error still showing up, i don't understand why people giving -1 when somebody have uncommon issue.Subchaser
ANy luck, even iam also facing the same issue. even after turn off the ssl certificateShoulders
Is there a example website that you can reproduce this issueSik
I completed all 3 of these and am still getting the same errorCardiovascular
I resolved this problem by removing the whitespace at the end of a url. copy/paste really got mePickwickian
I have the same issue even after following the 3 stepsLatish
A
6

May be you forgotten to add this lines into Program.cs,

app.UseAuthentication();
app.UseAuthorization();
Asmara answered 3/6, 2022 at 9:21 Comment(1)
This fixed my problem. And also got rid of my missing aud claim error.Quartz
L
1

First, your OS (Windows, Mac, Linux) must trust this certificate.

Then, in Postman, go to Settings > Certificates, and enable CA certification, then select the same trusted certificate.

Longawa answered 15/8, 2021 at 6:21 Comment(0)
S
1

I had the same issue with the Postman unable to verify the first certificate. The same localhost endpoint worked within a browser, but not in Postman while running in debug in VS. In my case re-installing IIS Express fixed the problem.

Salmon answered 25/2, 2022 at 19:45 Comment(0)
E
1

upload the root ca of the certificate issuer in postman and it will work

Eastwood answered 7/7, 2022 at 14:18 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Calisa
I has this issue with R3 (Let's Encrypt) certificate. To solve that, go to Settings -> Certificates -> CA Certificates and add the Root CA file. In my case it was ca.cer. Despite asking for a .pem file, I just sent the ca.cer file and it worked fine.Wallah
S
0

For me the issue was that my controller was annotated with a router template [Route("api/[controller]")] but my endpoints were not. Adding endpoint annotations worked:

[HttpGet("get")]
public string Get()
{
    return "get";
}
Smoothtongued answered 2/3, 2023 at 13:14 Comment(1)
At the very least, I believe HttpGet("get")] is missing a [. /shrugIncised
E
0

I solved the issue for me by recognizing, that my CA certificate file ending on .cer actually was not in Base64 format, but in DER binary format. Exporting it again in the right format worked. Nevertheless, it's pretty disturbing, that Postman accepts a file with the wrong format without complaining...

Emptyhanded answered 18/7, 2023 at 10:6 Comment(0)
G
0

keep in mind ! this order might be an issue this will impact directly .

in program.cs file .....

app.UseAuthentication(); //first line should be

app.UseAuthorization(); //second line should be

correct order is above.

Guacin answered 12/10, 2023 at 20:24 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Calisa
C
0

In my case, I went to Settings > Certificates > enable CA certificates, then Select File and selected our bundle.crt file (not a PEM file) and it worked.

Contestant answered 5/1 at 17:41 Comment(0)
P
0

Remove the whitespace at the end of the url.

This was the cause in my case and it took me hours to notice because I copy/paste the same url over and over again.

Why? I have no idea.

Pickwickian answered 28/3 at 13:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.