Obyi
Obyi

Reputation: 857

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

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.

Upvotes: 86

Views: 209722

Answers (10)

Hedva
Hedva

Reputation: 347

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.

Upvotes: 1

rmirabelle
rmirabelle

Reputation: 6444

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.

Upvotes: 0

mrhusky
mrhusky

Reputation: 31

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";
}

Upvotes: 0

Thanuda Warnakulage
Thanuda Warnakulage

Reputation: 1

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.

Upvotes: 0

ghuebner
ghuebner

Reputation: 1

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...

Upvotes: 0

Ramirez Xavior
Ramirez Xavior

Reputation: 37

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

Upvotes: 2

Mucahid Uslu
Mucahid Uslu

Reputation: 417

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

app.UseAuthentication();
app.UseAuthorization();

Upvotes: 6

samsu
samsu

Reputation: 87

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.

Upvotes: 1

zinger
zinger

Reputation: 319

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.

Upvotes: 1

PDHide
PDHide

Reputation: 19979

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

Upvotes: 76

Related Questions