aspnet / WebHooks

[Archived] Libraries to create and consume web hooks on ASP.NET Core. Project moved to https://github.com/aspnet/AspLabs
Apache License 2.0
627 stars 439 forks source link

How to use auto-wired instance/key configuration from receiver? #57

Closed diegohb closed 8 years ago

diegohb commented 8 years ago

Hello i've tried the following requests to see this work but continue to get the error "Could not find a valid configuration for WebHook receiver 'Pipedrive' and instance '#'. The setting must be set to a value between 32 and 128 characters long."

I've tried looking at all the different samples and tracing the code down and I can't really figure out why it won't match up under any configuration.

Requests:

POST /api/webhooks/incoming/pipedrive/1?code=bbbbaaaaaaaabbbbbb94583d6cf4cf1c0c7f767 HTTP/1.1 Host: localhost:30617 Content-Type: application/json

POST /api/webhooks/incoming/pipedrive/1 HTTP/1.1 Host: localhost:30617 Content-Type: application/json

POST /api/webhooks/incoming/pipedrive/bbbbaaaaaaaabbbbbb94583d6cf4cf1c0c7f767 HTTP/1.1 Host: localhost:30617 Content-Type: application/json

Configuration: <add key="MS_WebHookReceiverSecret_Pipedrive" value="aaa, 1=bbbbaaaaaaaabbbbbb94583d6cf4cf1c0c7f767, 2=3bbbbbbbbbbbb33333333333fffffffffd" /> and also tried just value = key (third POST request).

code: var receiverConfig = await this.GetReceiverConfig(pRequest, Name, pID, 32, 128);

and await EnsureValidCode(pRequest, pID);

diegohb commented 8 years ago

The immediate question is what would I loose by accessing Configuration setting directly in the receiver using ConfigurationManager.AppSettings and just parsing this out myself to validate the instance and code if I wanted to enforce ?

HenrikFrystykNielsen commented 8 years ago

Diego,

When you start up the server, you can see what is registered in the log output. That should hopefully tell you what is going on.

Let me know whether that helps! Henrik