ethomson / send-tweet-action

Send a tweet from a GitHub Action
MIT License
84 stars 8 forks source link

'Invalid token' error with default example. #9

Open joshuaiz opened 3 years ago

joshuaiz commented 3 years ago

Trying to send a tweet on push using the default example:

name: Send a Tweet
on: [push]
jobs:
  tweet:
    runs-on: ubuntu-latest
    steps:
      - uses: ethomson/send-tweet-action@v1
        with:
          status: "Test post from GitHub Actions."
          consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
          consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
          access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
          access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

and getting the following error:

Run ethomson/send-tweet-action@v1

/home/runner/work/_actions/ethomson/send-tweet-action/v1/dist/index.js:4841
                    throw error;
                    ^
[ { code: 89, message: 'Invalid or expired token.' } ]

My keys are in secrets and the app has Read + Write permissions on Twitter.

I tried:

^^ none of these are working.

Any idea why this wouldn't work and why I would be getting this error with new/regenerated keys?

joshuaiz commented 3 years ago

As a test I used my API keys to do a test post locally from Node and they work so the keys/permissions isn't the issue it seems.

apparition47 commented 3 years ago
Run ethomson/send-tweet-action@v1
/Users/runner/work/_actions/ethomson/send-tweet-action/v1/dist/index.js:4841
                    throw error;
                    ^

Error: HTTP Error: 401 Authorization Required
    at Request._callback (/Users/runner/work/_actions/ethomson/send-tweet-action/v1/dist/index.js:576:9)
    at Request.self.callback (/Users/runner/work/_actions/ethomson/send-tweet-action/v1/dist/index.js:15052:22)
    at Request.emit (events.js:210:5)
    at Request.<anonymous> (/Users/runner/work/_actions/ethomson/send-tweet-action/v1/dist/index.js:16028:10)
    at Request.emit (events.js:210:5)
    at IncomingMessage.<anonymous> (/Users/runner/work/_actions/ethomson/send-tweet-action/v1/dist/index.js:15950:12)
    at Object.onceWrapper (events.js:299:28)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

Having similar issues

fepegar commented 2 years ago

I am also getting a Error: HTTP Error: 401 Authorization Required, as @apparition47.

apparition47 commented 2 years ago

@fepegar I ended up using mugi111/tweet-trigger-release instead in my workflow

fepegar commented 2 years ago

I'll give it a try. Many thanks for sharing!

joshuaiz commented 2 years ago

For anyone interested, after not finding a solution to this error, I ended up rolling my own and wrote a post about it here: https://joshuaiz.com/words/using-github-actions-to-post-to-twitter-on-commit