Hello, im trying to create a webhook which will tr...
# pactflow
b
Hello, im trying to create a webhook which will trigger my azure devops pipeline. I created a PAT token and encoded it. I added it to secrets in pactflow and i created a system user (which i hope should be able to trigger it 🙂 ) In my webhook configuration im passing it like in documentation : Authorization: "Basic ${devopsUser.AzureDevopsServicesPAT}" - where devopsUser is a name which i gave to system user, i was trying also with only user. For some reasons when im looking into loggs there is no partcilar error and anythiung special beside this :
Copy code
[2024-02-19T15:01:08Z] INFO: x-tfs-serviceerror: TF400813%3A%20The%20user%20%27aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa%27%20is%20not%20authorized%20to%20access%20this%20resource.
[2024-02-19T15:01:08Z] INFO: x-vss-s2stargetservice: 00000002-0000-8888-8000-000000000000/visualstudio.com
[2024-02-19T15:01:08Z] INFO: request-context: appId=
[2024-02-19T15:01:08Z] INFO: access-control-expose-headers: Request-Context
[2024-02-19T15:01:08Z] INFO: x-content-type-options: nosniff
[2024-02-19T15:01:08Z] INFO: x-cache: CONFIG_NOCACHE
[2024-02-19T15:01:08Z] INFO: x-msedge-ref: Ref A: Ref B: SYD03EDGE1719 Ref C: 2024-02-19T15:01:07Z
[2024-02-19T15:01:08Z] INFO: date: Mon, 19 Feb 2024 15:01:08 GMT
[2024-02-19T15:01:08Z] INFO: <html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="<https://spsproduks1.vssps.visualstudio.com/_signin?realm=dev.azure.com&reply_to=>">here</a>.</h2>
</body></html>
I was checking PAT token permissions and they should allow to access this resource. Is there any working example of such webhook for azure or im missing something more ?
👋 1
m
I've seen this before. Try it without the surrounding quotes.
b
now i have like this Authorization: Basic ${devopsUser.AzureDevopsServicesPAT}
but still seems to not work
now i see less meaningful
Copy code
-02-19T15:13:37Z] INFO: HTTP/1.1 401 Unauthorized
do i need to encode my PAT token first ?
Copy code
[2024-02-19T15:16:30Z] INFO: HTTP/1.1 POST <https://dev.azure.com/[]>
[2024-02-19T15:16:30Z] INFO: accept: "application/json",
[2024-02-19T15:16:30Z] INFO: user-agent: Pact Broker v2.108.0
[2024-02-19T15:16:30Z] INFO: content-type: "application/json",
[2024-02-19T15:16:30Z] INFO: authorization: [REDACTED]
[2024-02-19T15:16:30Z] INFO: host: <http://dev.azure.com|dev.azure.com>
[2024-02-19T15:16:30Z] INFO: content-length: 0
[2024-02-19T15:16:30Z] INFO: 
[2024-02-19T15:16:30Z] INFO: HTTP/1.1 401 Unauthorized
do i need to also config something in azure devops ?
and btw can i use in secret this syntax : ${myUsername????.AzureDevopsServicesPAT}
or i need to stick with user.
m
Can you please show a screenshot of how you're setting it up?
b
full webhook you mean ? ok
☝️ 1
m
(all of the headers and setup not just the auth one)
b
i also tried with some body (default from template library)
m
Thanks. Try removing the quotes from all of the headers
b
i removed, i also ran this request using postman and its working fine
but in webhook i still receiving 401 😞
m
Do I see commas in there as well? They shouldn't be there
b
thanks, you are legend 🙂
to sum up this syntax was ok:
thanks again
Tbh worth to mention somewhere in documentation how to setup this from GUI
m
We're redoing this UI and I'll make sure it's covered. Commas are valid in headers, but not in this use case
Same with quotes
b
sure, thanks, maybe also worth to mention that for azure PAT token needs to be base64 encoded first
👍 1