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

401 Unauthorized error when tweeting the same tweet to multiple accounts #274

Closed
1 task done
alexeilinykh opened this issue Aug 23, 2023 · 9 comments
Closed
1 task done
Assignees

Comments

@alexeilinykh
Copy link

Describe the bug

When tweeting the same post to multiple accounts, only one account tweets and the other responds with a 401 Unauthorized error.

I believe this is because Twitter does not allow the exact same tweet to be published from multiple accounts.

It would be a better UX in the PrePublishPanel, if only 1 toggle was allowed to be turned on if there are multiple accounts available for tweeting.

Steps to Reproduce

  1. Add multiple twitter accounts to the plugin.
  2. Publish a post and try to tweet to both accounts.

Screenshots, screen recording, code snippet

Screenshot 2023-08-23 at 3 55 33 PM

Environment information

MacBook Pro 15 inch 2018
MacOs Ventura 13.3.1
Chrome Version 114.0.5735.106 (Official Build) (x86_64)

WordPress information

`

wp-core

version: 6.3
site_language: en_US
user_language: en_US
timezone: America/Los_Angeles
permalink: /%category%/%postname%/
https_status: true
multisite: false
user_registration: 0
blog_public: -1
default_comment_status: open
environment_type: staging
user_count: 496
dotorg_communication: true

wp-paths-sizes

wordpress_path: /var/www
wordpress_size: 0.00 B (0 bytes)
uploads_path: vip://wp-content/uploads
uploads_size: 0.00 B (0 bytes)
themes_path: /var/www/wp-content/themes
themes_size: 0.00 B (0 bytes)
plugins_path: /var/www/wp-content/plugins
plugins_size: 0.00 B (0 bytes)
database_size: 6.21 GB (6664863744 bytes)
total_size: 6.21 GB (6664863744 bytes)

wp-dropins (2)

db.php: true
object-cache.php: true

wp-active-theme

name: VentureBeat (vbnews) (vb-news)
version: 4.0
author: VentureBeat
author_website: http://www.venturebeat.com
parent_theme: none
theme_features: core-block-patterns, widgets-block-editor, post-thumbnails, widgets, infinite-scroll, editor-style
theme_path: /var/www/wp-content/themes/vb-news

wp-mu-plugins (39)

Admin Notice: version: 0.1.0, author: WordPress VIP
Advanced Post Caching: version: 0.2, author: Automattic
Akismet Anti-Spam: version: 5.1, author: Automattic
Async Publish Actions: author: Automattic, version: (undefined)
blogpublic-notice.php: author: (undefined), version: (undefined)
HTTP Concat: version: 1.0, author: Automattic
Jetpack: version: 12.4, author: Automattic
Lightweight Term Count Update: version: 0.1.0, author: Automattic, Alley Interactive
prometheus.php: author: (undefined), version: (undefined)
query-monitor.php: author: (undefined), version: (undefined)
REST API Enhancements: version: 0.1, author: Erick Hitter, Automattic
Rewrite Rules Inspector: version: 1.3.1, author: Automattic, Daniel Bachhuber
VaultPress: version: 2.2.1, author: Automattic
VIP AllOptions Safeguard: author: Automattic, version: (undefined)
VIP Back-compat: version: 1.0, author: Automattic
VIP Cache Manager: version: 1.1, author: Automattic
VIP Client mu-plugins: author: Automattic, version: (undefined)
VIP Codebase Manager: version: 1.0.0, author: Automattic
VIP Cron Enhancements: version: 1.0, author: Automattic
VIP Dashboard: version: 3.0.0, author: Scott Evans, Filipe Varela, Pau Argelaguet
VIP Feed Cache: author: Automattic, version: (undefined)
VIP File Service: version: 0.2, author: Automattic
VIP Force Two Factor: author: Automattic, version: (undefined)
VIP Go Core Modifications: author: Automattic, version: (undefined)
VIP Go Plugin Compat: version: 1.0, author: Automattic
VIP Hosting Miscellaneous: version: 1.1, author: Automattic
VIP Init: author: Automattic, version: (undefined)
VIP Integrations: author: Automattic, version: (undefined)
VIP Mail: version: 1.0, author: Automattic
VIP Parse.ly Integration: version: 1.0, author: Automattic
VIP Performance: version: 1.0, author: Automattic
VIP Plugins: version: 1.0.0, author: Automattic
VIP Schema: author: Automattic, version: (undefined)
VIP Security: version: 1.2, author: Automattic
VIP Stats: author: Automattic, version: (undefined)
WooCommerce: VIP Specific Changes: version: 1.0.0, author: Automattic
WordPress Importer: version: 0.6.4, author: wordpressdotorg
WordPress VIP Support: version: 3.1.0, author: Automattic
WP-CLI for VIP Go: author: Automattic, version: (undefined)

wp-plugins-active (20)

Adbusters: version: 1.0.7, author: Paul Gibbs, Mohammad Jangda, Automattic
Aditude AMP Wordpress: version: 1.2.5, author: Aditude Inc
Advanced Custom Fields PRO: version: 5.9.9, author: Delicious Brains (latest version: 6.2.0)
Autoshare for Twitter: version: 2.1.0, author: 10up (latest version: 2.1.1)
Co-Authors Plus: version: 3.4.91, author: Mohammad Jangda, Daniel Bachhuber, Automattic (latest version: 3.5.13)
Disable REST API: version: 1.7, author: Dave McHale
ET-Proxy: author: (undefined), version: 1.0.7
Gravity Forms: version: 2.7.7.1, author: Gravity Forms (latest version: 2.7.13)
HTTPS All the Things!: version: 1.0, author: Ryan Markel, John Blackbourn
Metro Sitemap: version: 1.4.1, author: Artur Synowiec, Paul Kevan, and others
Post Meta Inspector: version: 1.1.1, author: Daniel Bachhuber, Automattic
Publish to Apple News: version: 2.3.2, author: Alley (latest version: 2.4.0)
Term Management Tools: version: 1.1.4, author: scribu (latest version: 2.0.1)
View All Posts Pages: version: 0.9.3, author: Erick Hitter & Oomph, Inc. (latest version: 0.9.4)
VIP Go Geo Uniques: version: 0.1.01, author: Automattic, WordPress VIP
WordPress Editorial Calendar: version: 3.7.8, author: Colin Vernon, Justin Evans, Joachim Kudish, Mary Vogt, and Zack Grossbart
WP Large Options: version: 1.0.1, author: prettyboymp, voceplatforms
WP Media folder: version: 5.5.10, author: Joomunited (latest version: 5.6.0)
Yoast SEO: version: 20.5, author: Team Yoast (latest version: 21.0)
Yoast SEO Premium: version: 20.5, author: Team Yoast

wp-plugins-inactive (3)

AMP: version: 2.3.0, author: AMP Project Contributors (latest version: 2.4.2)
Permalink Manager Pro: version: 2.2.17, author: Maciej Bis
wp_enqueue_media Override: version: 1.0.0, author: Alley Interactive

wp-media

image_editor: WP_Image_Editor_GD
imagick_module_version: Not available
imagemagick_version: Not available
imagick_version: Not available
file_uploads: File uploads is turned off
post_max_size: 2047M
upload_max_filesize: 2047M
max_effective_size: 2 GB
max_file_uploads: 20
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP
ghostscript_version: not available

wp-server

server_architecture: Linux 5.10.0-21-amd64 x86_64
httpd_software: nginx
php_version: 8.0.30 64bit
php_sapi: fpm-fcgi
max_input_variables: 6144
time_limit: 1200
memory_limit: 1024M
max_input_time: 1200
upload_max_filesize: 2047M
php_post_max_size: 2047M
curl_version: 8.0.1 OpenSSL/1.1.1n
suhosin: false
imagick_availability: false
pretty_permalinks: true
current: 2023-08-23T23:02:03+00:00
utc-time: Wednesday, 23-Aug-23 23:02:03 UTC
server-time: 2023-08-23T16:02:02-07:00

wp-database

extension: mysqli
server_version: 8.0.28
client_version: mysqlnd 8.0.30
max_allowed_packet: 67108864
max_connections: 400

wp-constants

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /var/www/wp-content
WP_PLUGIN_DIR: /var/www/wp-content/plugins
WP_MEMORY_LIMIT: 1024M
WP_MAX_MEMORY_LIMIT: 512M
WP_DEBUG: true
WP_DEBUG_DISPLAY: false
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: staging
WP_DEVELOPMENT_MODE: undefined
DB_CHARSET: utf8mb4
DB_COLLATE: utf8mb4_unicode_ci

wp-filesystem

wordpress: not writable
wp-content: not writable
uploads: writable
plugins: not writable
themes: not writable
mu-plugins: not writable

jetpack

site_id: 177008332
ssl_cert: No
time_diff: false
version_option: 12.4:1691490513
old_version: 12.3:1689270318
public: Public
master_user: #420 wpcomvip
is_offline_mode: off
is_offline_mode_constant: off
current_user: #295 alexeilinykh
tokens_set: Blog User
blog_token: AhKvefB5FzgDeQF7bUxWSCNnPH$^k5@P
user_token: )%(yB7m5LVKs%a$Aj*xW@sAI$oYecK
version: 12.4
jp_plugin_dir: /var/www/wp-content/mu-plugins/jetpack-12.4/
plan: free
protect_header: {"trusted_header":"REMOTE_ADDR","segments":1,"reverse":false}
full_sync: {"started":"Thu, 25 May 2023 17:11:47 +0000","finished":"Thu, 25 May 2023 17:12:04 +0000","progress":{"options":{"finished":true},"functions":{"finished":true}},"config":{"options":true,"functions":true}}
sync_size: undefined
sync_lag: 0 seconds
full_sync_size: undefined
full_sync_lag: 0 seconds
idc_urls: {"home":"https://venturebeat-com-preprod.go-vip.co","siteurl":"https://venturebeat-com-preprod.go-vip.co","WP_HOME":"","WP_SITEURL":""}
idc_error_option: false
idc_optin: true
cxn_tests: All Pass.

`

Code of Conduct

  • I agree to follow this project's Code of Conduct
@alexeilinykh
Copy link
Author

Actually it looks like only one set of API keys and Secrets is being saved in settings. So when you add multiple accounts, the new API key and Secret gets overwritten, which is what's causing the 401 Unauthorized error.

@iamdharmesh iamdharmesh moved this from Incoming to To Do in Open Source Practice Aug 25, 2023
@iamdharmesh iamdharmesh self-assigned this Aug 25, 2023
@iamdharmesh
Copy link
Member

Hi @alexeilinykh,

Thanks for reporting an issue.

I've attempted to replicate the problem but haven't encountered any issues on my end. The tweet is working fine for me for tweets to multiple accounts at the same time and the same post. Given the error code (401), it seems that there might be an authentication issue. Could you please attempt disconnecting and then re-connecting your Twitter accounts, and then try again? This might resolve the issue.

Thanks

@alexeilinykh
Copy link
Author

I did, and I still got the same error when tweeting to the first account but not the 2nd.

My understanding is that each separate twitter account that gets added has a different set of api_key and api_secret. However, the settings page can only save one set of api_key/api_secret(s). So the initial account that was added has its api_key and api_secret overwritten when a 2nd account is added.

@Sidsector9
Copy link
Member

Hi @iamdharmesh,

I have tested this with:

  • 2 connected accounts
  • "Tweet again" existing post
  • Tweet a new post
  • "Tweet again" the new post

It is working fine for me 👍

You can see the tweets here:

@alexeilinykh
Copy link
Author

How did you add the 2nd account? Were you using the same api key and secret as the first account?

Don't you need to use a different set of key/secrets to add a 2nd account? And only one set of key/secrets is saved in the DB. I am starting to sound like a broken record here.

@iamdharmesh
Copy link
Member

How did you add the 2nd account? Were you using the same api key and secret as the first account?

@alexeilinykh You need to save API key and a secret only once. Multiple accounts can be connected using the same API key and secret. Please try to connect 2nd account using the same key and secret it will work fine.

Don't you need to use a different set of key/secrets to add a 2nd account?

As mentioned above, no need to save different sets of keys/secrets for each account. Save key/secret once and connect multiple accounts. Changing the key/secret will break the previously connected accounts.

@jeffpaul jeffpaul added the needs:feedback This requires reporter feedback to better understand the request. label Sep 11, 2023
@alexeilinykh
Copy link
Author

Each account has a different set of keys and secrets. I get a 401 unauthorized error when trying to add a second account with the key and secret from the first account.

@github-actions github-actions bot removed the needs:feedback This requires reporter feedback to better understand the request. label Sep 19, 2023
@jeffpaul jeffpaul added this to the Future Release milestone Jan 11, 2024
@jeffpaul jeffpaul moved this from To Do to In Progress in Open Source Practice Jan 11, 2024
@jeffpaul
Copy link
Member

@iamdharmesh is this actionable?

@iamdharmesh
Copy link
Member

@jeffpaul I am not able to reproduce this and we don't have any similar report. It seems we are good to proceed with closing this. Please feel free to re-open this if we have any new reports in the future.

Thanks.

@github-project-automation github-project-automation bot moved this from In Progress to Merged in Open Source Practice Jan 26, 2024
@jeffpaul jeffpaul removed this from the Future Release milestone Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants