Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.92k stars 442 forks source link

Add support for API Keys authentication with Twilio Binding #8039

Open Swimburger opened 2 years ago

Swimburger commented 2 years ago

What problem would the feature you're requesting solve? Please describe.

Currently, the Twilio binding requires you to use the account SID and the account auth token. This is the quickest way to authenticate, but a better way is to use Twilio API keys. You can read more about switching to API keys with C# here: https://www.twilio.com/blog/better-twilio-authentication-csharp-twilio-api-keys

Describe the solution you'd like

Add a property or properties to support API keys. In Twilio's SDK the arguments to authenticate are username, password, and account SID. To authenticate using account SID and account auth token, you'd pass in account sid to the username, and the account auth token to the password. To authenticate using API keys, you'd pass in the API key SID to the username, and the API key secret to the password, and the account SID to accountSid. Since the Twilio attribute for the Azure Function binding uses different property names, you probably can't follow the same naming convention without a breaking change.

I'd suggest adding 2 new properties to make this as explicit as possible without breaking changes.

If those are filled out, you know the user wants to use API key authentication. Or even more explicitly, you could add an enum property to switch between the two types of auth.

Describe alternatives you've considered

I tried using the API key SID and API key secret as account SID and auth token in the binding, but that didn't work.

v-bbalaiagar commented 2 years ago

Hi @Swimburger , Thank you for your feedback! We will check for the possibilities internally and update you with the findings.

v-bbalaiagar commented 2 years ago

Hi @Swimburger , Opened a new issue for further insights - https://github.com/twilio/twilio-csharp/issues/593. Closing this issue here.

Swimburger commented 2 years ago

I'm confused why an issue would be opened at Twilio's C# SDK repo, it already supports what I am suggesting which is described in the article I referenced. This is a feature request for the Twilio binding for Azure Functions, not for the Twilio C# SDK.

v-bbalaiagar commented 2 years ago

Hi @Swimburger , Apologies for the confusion. We will investigate this further and update you with the findings.

v-bbalaiagar commented 2 years ago

Hi @Swimburger , I checked this internally. Adding this issue as a feature request to consider this in future implementations.