Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4056

REST API Call in VS Project Fails Authentication in Gitlab Job

$
0
0

Summary

Visual Studio C# Project makes a call to a REST API in one of its SpecFlow tests.

Running VS locally, the call succeeds.

Running in a Gitlab CI job, the call fails with an HTTP 403 error.

Details

The code creates an X509 certificate, stores it in an HttpClientHandler which is then associated with the HttpClient that makes the call.

I printed out debug statements so that I could compare properties of the certificate in both environments.

There were only two differences of note, that I could see.

In VS:

Got x509: PrivateKeyAlias, 

In Gitlab Pipeline console:

Got x509: ,

The rest of the cert attributes were filled in. The start and end dates were different; that might be a factor.

What could be causing this difference in behavior in local VS versus the gitlab runner?Please suggest other factors I should look for or compare.

Gitlab:

Running with gitlab-runner 16.5.0 (853330f9)on KubernetesRunnerUsing Kubernetes namespace: gitlab-runnerUsing Kubernetes executor with image xxx.jfrog.io/xxx-docker/dotnet/sdk7:latest... (.NETCoreApp,Version=v7.0)...Microsoft (R) Test Execution Command Line Tool Version 17.5.0 (x64)

enter image description hereenter image description here


Viewing all articles
Browse latest Browse all 4056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>