Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secret Key being used in URLs #13

Open
andrewwatson opened this issue Mar 29, 2017 · 7 comments
Open

Secret Key being used in URLs #13

andrewwatson opened this issue Mar 29, 2017 · 7 comments

Comments

@andrewwatson
Copy link

I created an API Key (https://www.twilio.com/docs/api/rest/keys) and tried to use it with twilio-go and I keep getting authentication failures.

@kevinburke
Copy link
Collaborator

hey! looking now...

@andrewwatson
Copy link
Author

I have a fix in my fork...

@andrewwatson
Copy link
Author

andrewwatson@64e118f

@kevinburke
Copy link
Collaborator

Can you share the code you're using and the error you're getting? It should be something like

client := twilio.NewClient("SK123", "auth_token", nil)
client.Messages.SendMessage(...)

If you use the secret SK key in place of the account sid, it should be fine, I think. I'm reluctant to add a new parameter if they're both just strings.

@andrewwatson
Copy link
Author

I tried using the key instead but it uses that account ID in other places, like in the URIs of resources so it was breaking downstream.

@kevinburke
Copy link
Collaborator

Ohhhhh, crap, okay. Let me think about this.

@kevinburke kevinburke changed the title Authentication Fails with API Keys vs. Secrets Secret Key being used in URLs Mar 29, 2017
kevinburke added a commit to kevinburke/twilio-go that referenced this issue Mar 29, 2017
Secret keys need to be present in the HTTP auth field but not in the
URL. Add a new UseSecretKey method on the client that modifies the
auth field, but not the URL fields.

Fixes saintpete#13.
@kevinburke
Copy link
Collaborator

kevinburke commented Mar 29, 2017

I just pushed version 0.58 to https://github.com/kevinburke/twilio-go which fixes this problem.

client := twilio.NewClient("AC123", "123", nil)
client.UseSecretKey("SK123")
client.Messages.SendMessage("123", "456", "Sending with secret key...", nil)

Unfortunately that version of the library expects you to have a "context" package in the standard library, which isn't currently supported on App Engine, unless you're using AE Flex. You can just grab the patch if you want: kevinburke@6ee7bc6

I'll send you an email with some ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants