Closed kheraankit closed 3 months ago
we have a page on auth in the docs
https://docs.pact.io/provider/handling_auth
ruby doesn’t have a native request filter but there are a couple of options
custom header
you can also provide custom middleware and create your own request filter, see the pact provider proxy project for an example
Description: We're using Pact for contract testing in a Rails application with token-based API authentication. Our setup involves dynamically creating users and generating tokens in provider states, but we're facing challenges in injecting these tokens as authentication headers into Pact's verification requests.
Challenges:
No clear method for modifying Pact verification requests to include dynamic authentication headers. Lack of documentation on handling authentication scenarios where tokens are generated during provider state setup. Key Questions:
How can we inject dynamic authentication headers, based on tokens from provider states, into Pact verification requests? Are there best practices or alternative approaches within Pact for authenticated requests, especially with dynamically generated user tokens? Our goal is to ensure verification requests are authenticated similarly to real-world API calls. Any guidance or feature consideration to facilitate this would greatly benefit users facing similar authentication setups.
Thank you for your support and the ongoing development of Pact.