souramoo / commentoplusplus

Commento with out of the box patches and updates to add useful features and fixes. Also with one-click deploy to Heroku so you can get up and running fast.
MIT License
389 stars 62 forks source link

Is Twitter OAuth still supported? #92

Closed olof-nord closed 2 years ago

olof-nord commented 2 years ago

I have tried to set up Twitter OAuth1 for commentoplusplus using the described two environment variables (COMMENTO_TWITTER_KEY and COMMENTO_TWITTER_SECRET), but without success.

Where I believe I am failing is on the twitter side, in the Developer Portal.

If the OAuth integration does work, does anyone know what I should configure there? Especially at the "User authentication settings" for the app.

Here is what I use at the moment:

OAuth 2.0: off OAuth 1.0a: on

OAuth 1.0a settings

Request email from users: on (as per this issue, which currently is two years old) App permissions: Read and Write Callback URL: https://commento.my.domain/api/oauth/twitter/callback Website URL: https://commento.my.domain

This does not work, and I keep seeing errors in the logs:

commento       | 2022/04/06 12:27:52 [ERROR] oauth_twitter_redirect.go:26 twitterRedirectHandler(): cannot get temporary twitter credentials: OAuth server status 401, {"errors":[{"code":32,"message":"Could not authenticate you."}]}

And in the browser the following error is displayed when trying to log in:

error: An internal error has occurred. If you see this repeatedly, please contact support.

Now, are my OAuth settings correct? Where should I get the two values from, from Consumer Keys, Access Token and Secret or OAuth 2.0 Client ID and Client Secret?

Any info would be greatly appreciated.

souramoo commented 2 years ago

Hi,

Many thanks for your recent contributions!

Twitter OAuth certainly does work, it is enabled on the demo site at https://demo.souradip.com/chat.html

You are correct in using OAuth 1.0a. You will need to add the Access token and secret and put them into the environment variables COMMENTO_TWITTER_KEY and COMMENTO_TWITTER_SECRET as you have described.

You just have to click the top tab that says "Keys and tokens" next to "settings" after accessing your app settings at https://developer.twitter.com/en/portal to obtain the values to configure commento++ with.

image

Does this work? Or do you continue to get errors after configuring these token values into commento?

olof-nord commented 2 years ago

Many many thanks! I was using some other tokens/secret combination I believe.

Now there is just the wait to get my Elevated Twitter API request approved.