Hi <@UELMFD9PG> Nabi (<pactflow.io>), I have been ...
# pact-net
j
Hi @Yousaf Nabi (pactflow.io) Nabi (pactflow.io), I have been following your example at https://github.com/tjohnjoel/example-provider-dotnet is there a way to authenticate a provider Api using pactNet latest version.
m
Hi John, please avoid
@
ing people
👍 1
what do you mean by “authenticate”?
j
The provider Api uses a Jwt authorization header to access, I am trying to add a Bearer key in provider side testcase for a successful execution. According to PactNet 4 migration document https://github.com/pact-foundation/pact-net/blob/master/docs/upgrading-to-4.md It is recommended that verification tests run without authentication, but what if I have to use an authentication token. Is there a workaround for this?
m
Have you read howtoauth ?
s
Approaches to handling authentication in Pact tests: https://docs.pact.io/provider/handling_auth
y
are you just trying to add one when it doesn’t exist, or validate that it does exist, is the correct format and then update it.? https://github.com/you54f/pact-workshops here is some examples of the pact-net workshops which show auth mechanisms. I believe there is a withCustomProviderHeader func, there was a gh issue about it recently in pact-net which is work a look