xdevplatform / account-activity-dashboard

Sample web app and helper scripts to get started with the premium Account Activity API
Apache License 2.0
169 stars 96 forks source link

Error Webhook config unable to be retrieved #10

Open unkn0wnU53r opened 5 years ago

unkn0wnU53r commented 5 years ago

Error Webhook config unable to be retrieved

Getting an error as outlined above when i click on Manage Webhooks. i am not sure what that implies. Permission of the config. json file set to 777 error still persists. How can i solve ths issue. The json respone seen in the cli indicates Error: Code 32 Message: Could not authenticate you. I am sure the Apps Access permission and Keys, secret keys and access tokens are right and properly set in the config.json aswell as the TWITTER_WEBHOOK_ENV and Callback URLs.

Do those different Error messages point to the same Problem?

How do i start solving this facer? Where should i start what should i do next?

Any help appreciated. Many thanks in advance.

PS: i feel like it is unsettling that the "Dev environment label" in the documentation is referred to as "envoirment name". Maybe that should be changed for a clearer naming consistency.

gkimpson commented 5 years ago

Did you figure out what was causing this error message?

lchinitz commented 4 years ago

I have a similar problem, but a different error. I have tried everything I can think of, and am hoping someone has a suggestion. I am confident that my keys/tokens are correct, but when I use the dashboard to create the webhook, I get this message:

Webhook URL does not meet the requirements. Invalid CRC token or json response format.

I was thinking that it was just the format of the response, but I have tried a whole bunch of things, based on the python example, and so far, no luck. My server is node.js, and here's the code. The request is definitely getting there (I can see it in the logs) but the return is apparently bad.

I'm using the crypto library to create the hmac (again, as in the example provided here.)

function twitterWebhook(req, res, next)
{
    my.logger.verbose('Entered the Twitter Webhook');
    my.logger.verbose('Here is the url:  ' + JSON.stringify(req.url));
    my.logger.verbose('Here is the query:  ' + JSON.stringify(req.query));

    var crc_token = req.query.crc_token;

    my.logger.verbose('crc_token is:  ' + crc_token);
    my.logger.verbose('secret is   :  ' + conf.T_consumer_secret);

    var hmac = crypto.createHmac('sha256', conf.T_consumer_secret).update(crc_token).digest('base64');
    my.logger.verbose('hmac is     :  ' + hmac);

    if (req.method.toLowerCase() == 'get'){
        var aResponse = {response_token:hmac};
        var aResponseString = JSON.stringify(aResponse);
        my.logger.verbose('Responding with   :  ' + aResponseString);
        res.json(aResponseString);
        //res.json(hmac);
    }
return;
rkalra1996 commented 4 years ago

I have had a similar issue. From what i can understand, it could be possible that your node server is taking more than 3 secs to return the sha256 token for crc verification. It is written in the requirements of setting up a webhook. Do verify if its true