Skip to content

Clarify use of API keys #531

Open
Open
@hultqvist

Description

@hultqvist

The Twilio console for API keys states:

You can use API Keys to authenticate to the REST API using basic auth, with user=KeySid and password=KeySecret.

This made me think I could use code like this:

//public static void Init(string username, string password);
TwilioClient.Init(keySID, keySecret);

But that didn't work.
This one did:

// Summary:
//     Initialize base client with separate account SID
//public static void Init(string username, string password, string accountSid);
TwilioClient.Init(keySID, keySecret, accountSID);

Have I understood it correctly in that the first Init only works with Account SID and the other Init is intended for API keys?

If so I think you should update the API signature to reflect this.

In the first Init, rename the parameters to accountSID and authToken.

In the second Init, rename the parameters to keySID, keySecret and remove the comment in the summary about "separate account SID" since that made me think you can use one account credential to init against another account(which doesn't make sense)

/// <summary>
/// Initialize base client with username and password
/// </summary>
/// <param name="username">Auth username</param>
/// <param name="password">Auth password</param>
public static void Init(string username, string password)
{
SetUsername(username);
SetPassword(password);
}
/// <summary>
/// Initialize base client with separate account SID
/// </summary>
/// <param name="username">Auth username</param>
/// <param name="password">Auth password</param>
/// <param name="accountSid">Account SID to use</param>
public static void Init(string username, string password, string accountSid)
{
SetUsername(username);
SetPassword(password);
SetAccountSid(accountSid);
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions