403 on twitter.accountsAndUsers.accountUpdateProfileBanner()
baumannzone opened this issue · 1 comments
baumannzone commented
Describe the bug
I'm trying to update the Twitter banner of my user. I've created and tested with both v1 and v2 applications in the developer portal.
Here is my code:
const twitterClient = new TwitterClient({
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET,
accessToken: process.env.CONSUMER_KEY,
accessTokenSecret: process.env.CONSUMER_SECRET,
});
const uploadBanner = async () => {
const base64 = fs.readFileSync('1500x500.png', { encoding: 'base64' });
try {
await twitterClient.accountsAndUsers.accountUpdateProfileBanner({
banner: base64,
});
} catch (err) {
console.log(err);
}
};
To reproduce
Steps to reproduce the behaviour:
- Create a new
TwitterClient
instance - Get the last 3 followers (just for testing the client works)
- Read with
fs
an image (base64) - Get an error when trying to update the profile banner
The error: { statusCode: 403, data: '' }
Expected behaviour
The banner was successfully updated on Twitter
** Package Manager: **
- nodejs: v16.13.2
- npm: 8.1.2
- Mac OS Monterey 12.2.1 (M1)
- From
package.json
:"twitter-api-client": "^1.5.2"
Additional context
AFAIK it has to be less than 700kb. The image size I'm using is ~200kb
Edit:
I'm starting to think it's related to the app settings and permissions.
I managed to get the latest followers. So, the client connection works.
baumannzone commented