muesli / beehive

A flexible event/agent & automation system with lots of bees 🐝
GNU Affero General Public License v3.0
6.3k stars 324 forks source link

Trim configuration value strings where appropriate #253

Open Riduidel opened 5 years ago

Riduidel commented 5 years ago

I'm trying to replace IFTTT by Beehive running on my raspberry 3 (which uses Raspbian Stretch).

Beehive starts normally, but when I try to set up twitter bee, I get this error message

ERRO[0001] [Riduidel's Twitter]: Error: Could not verify Twitter API Credentials (Get https://api.twitter.com/1.1/account/verify_credentials.json?include_entities=false&skip_status=true&tweet_mode=extended returned status 401, {"errors":[{"code":32,"message":"Could not authenticate you."}]})
INFO[0001] Fatal bee event: Could not verify Twitter API Credentials 0
ERRO[0001] [Riduidel's Twitter]: Error: Could not verify Twitter API Credentials (Get https://api.twitter.com/1.1/account/verify_credentials.json?include_entities=false&skip_status=true&tweet_mode=extended returned status 401, {"errors":[{"code":32,"message":"Could not authenticate you."}]})
INFO[0001] Fatal bee event: Could not verify Twitter API Credentials 1
ERRO[0001] [Riduidel's Twitter]: Error: Could not verify Twitter API Credentials (Get https://api.twitter.com/1.1/account/verify_credentials.json?include_entities=false&skip_status=true&tweet_mode=extended returned status 401, {"errors":[{"code":32,"message":"Could not authenticate you."}]})
INFO[0001] Fatal bee event: Could not verify Twitter API Credentials 2
INFO[0001] Terminating evil bee Riduidel's Twitter after 3 failed tries!

I'm using credentials given by dev.twitter.com application page. Is there something I'm missing/misconfiguring ?

Riduidel commented 5 years ago

My raspberry is able to connect to api.twitter.com, so it's not a network error

curl  https://api.twitter.com/1.1/account/verify_credentials.json?include_entities=false&skip_status=true&tweet_mode=extended
{"errors":[{"code":215,"message":"Bad Authentication data."}]}
Riduidel commented 5 years ago

And notice I've literaly copy/pasted credentials obtained from twitter (and they are visible in the beehive.conf file (but I won't show them)

Riduidel commented 5 years ago

Interestingly, i've tried using those keys with tweetledee (http://tweetledee.github.io/tweetledee/), installed on the same Raspberry server, and it doesn't work either ! So it seems like the keys are ... not the ones adapted to that kind of application, which is weird.

muesli commented 5 years ago

I don't think this is related to Raspbian or the Pi. How/where exactly did you obtain your keys? You essentially need to create a new Application over on https://developer.twitter.com/en/apps

Next you'll need to generate an accesstoken for that newly created application there.

Riduidel commented 5 years ago

Yes that's exactly what I did

I have created my application

image

And I've created my customer key/secret and access key/secret

image

That I've copied in beehive Twitter bee config

... Well, forget about it, it seems like i've copy/pasted the consumer key with a space after (which was not trimmed by beehive). As a consequence, consumer key was bad.

Do you think it would be possible to always have those keys trimmed in UI ? because sometimes copy/pasting things is ... inefficient

Riduidel commented 5 years ago

oh yes it works ! https://twitter.com/riduidel/status/1133642224460283905

muesli commented 5 years ago

Yeah, trimming those strings is probably a good idea! I'll rename and reopen the ticket to match that suggestion. Thanks for your feedback!