P
Postiz•3mo ago
Support

Ticket: Unable to Add Provider, Connection Issue

@Auxaldeus Just created a ticket
Question: Unable to add X provider: Could not connect to the platform
Attempted: Tried it using tweepy python script and it works with the following:
newapi = tweepy.Client(
bearer_token=BEARER_TOKEN,
access_token=ACCESS_KEY,
access_token_secret=ACCESS_SECRET,
consumer_key=CONSUMER_KEY,
consumer_secret=CONSUMER_SECRET,
)
newapi = tweepy.Client(
bearer_token=BEARER_TOKEN,
access_token=ACCESS_KEY,
access_token_secret=ACCESS_SECRET,
consumer_key=CONSUMER_KEY,
consumer_secret=CONSUMER_SECRET,
)
X_API_KEY=CONSUMER_KKEY X_API_SECRET=CONSUMER_SECRET
Working On: Setup
Take it from here @Mod 🔥
64 Replies
Auxaldeus
Auxaldeus•3mo ago
No description
Auxaldeus
Auxaldeus•3mo ago
I also tried setting X_CLIENT to OAUTH2.0 CLIENT ID and X_SECRET to OAUTH2.0 CLIENT SECRET Self Hosting btw
Support
SupportOP•3mo ago
@Mod 🔥 please help @Auxaldeus
Auxaldeus
Auxaldeus•3mo ago
sup
Nevo David
Nevo David•3mo ago
api key and secret is not consumer key and consumer secret, you need client id and client secret it's not the same things
Auxaldeus
Auxaldeus•3mo ago
Can you clarify? I followed the instruction from here
Auxaldeus
Auxaldeus•3mo ago
Postiz Documentation
X – Postiz Docs
How to add X to your system
Auxaldeus
Auxaldeus•3mo ago
Click on "Regenerate" inside "Consumer Keys" and copy the API Key and API Key Secret. Open .env file and add the following: X_API_KEY="" X_API_SECRET="" the env file I'm editing from: /var/lib/docker/volumes/socials_postiz-config/_data/postiz.env
Nevo David
Nevo David•3mo ago
Do you see this section? @Auxaldeus
No description
Auxaldeus
Auxaldeus•3mo ago
yes
Nevo David
Nevo David•3mo ago
BTW, what did you put in: "Callback URI / Redirect URL" ?
Auxaldeus
Auxaldeus•3mo ago
http://localhost:4200/integrations/social/x
Nevo David
Nevo David•3mo ago
What do you have in
No description
Auxaldeus
Auxaldeus•3mo ago
No description
Auxaldeus
Auxaldeus•3mo ago
So this is supposed to be set to X_API_KEY and X_API_SECRET?
Nevo David
Nevo David•3mo ago
Yes it's not what you used?
Auxaldeus
Auxaldeus•3mo ago
yes and left X_CLIENT="" X_SECRET="" blank Mind you it is running behind this nginx config:
Auxaldeus
Auxaldeus•3mo ago
Auxaldeus
Auxaldeus•3mo ago
@Nevo David I think the docs need to be updated, it still references Twitter v1 API
No description
Auxaldeus
Auxaldeus•3mo ago
And says that the consumer keys not the OAuth 2.0 Client ID and Client Secret have to be there
Auxaldeus
Auxaldeus•3mo ago
@Nevo David perhaps twitter-api-v2 needs to be updated to 1.18: https://github.com/PLhery/node-twitter-api-v2/pull/532
Nevo David
Nevo David•3mo ago
doubtfully, it's working on https://platform.postiz.com What is the error that you get?
Auxaldeus
Auxaldeus•3mo ago
I get Could not connect to the platform https://postiz.example.com/api/integrations/social/x returns: {"err":true}
Auxaldeus
Auxaldeus•3mo ago
my config file
No description
Auxaldeus
Auxaldeus•3mo ago
values are set with: OAuth 2.0 Client ID and Client Secret from
No description
Auxaldeus
Auxaldeus•3mo ago
there are also no other logs printed in: docker logs postiz --follow
Nevo David
Nevo David•3mo ago
Did you manage to connect other platforms? Problem might not be with X Do you have access to the code? You can console log the error
Auxaldeus
Auxaldeus•3mo ago
Code in the container or clone the repo?
Nevo David
Nevo David•3mo ago
I mean any, it's just this line. You can console.log(err)
No description
Nevo David
Nevo David•3mo ago
see what is the problem
Auxaldeus
Auxaldeus•3mo ago
interesting, so it works when I run it locally using npm run dev but not in the docker container
Nevo David
Nevo David•3mo ago
Need to console log the err probably failing on something else my suspicions is the uploading
Auxaldeus
Auxaldeus•3mo ago
yeah just can't figure out how to run the console.log(err); in the docker container. Can't find postiz-app/apps/backend/src/api/routes/integrations.controller.ts
Nevo David
Nevo David•3mo ago
The problem is with your uploading, do you use local or cloudflare?
Auxaldeus
Auxaldeus•3mo ago
local
Nevo David
Nevo David•3mo ago
ok, are you sure it's creating the volume? Wait, the error is after the redirect or before?
Auxaldeus
Auxaldeus•3mo ago
yep:
[root@docker]/var/lib/docker/volumes# ls | grep postiz
socials_postiz-config
socials_postiz-redis-data
socials_postiz-uploads
[root@docker]/var/lib/docker/volumes# ls | grep postiz
socials_postiz-config
socials_postiz-redis-data
socials_postiz-uploads
Auxaldeus
Auxaldeus•3mo ago
No description
Auxaldeus
Auxaldeus•3mo ago
before. clicking on facebook page redirects to facebook X fails to even redirect and is actually the only one that fails to redirect it also doesn't redirect if I leave X_API and XSECRET empty whereas the other ones redirect while they're empty Here's the log on the dev version when the X env variables are empty:
GET /launches 200 in 142ms
Error: Invalid consumer tokens
at ClientRequestMaker.buildOAuth (/home/user/postiz-app/node_modules/twitter-api-v2/dist/cjs/client-mixins/request-maker.mixin.js:164:19)
at ClientRequestMaker.initializeToken (/home/user/postiz-app/node_modules/twitter-api-v2/dist/cjs/client-mixins/request-maker.mixin.js:121:32)
at new TwitterApiBase (/home/user/postiz-app/node_modules/twitter-api-v2/dist/cjs/client.base.js:18:32)
at new TwitterApi (/home/user/postiz-app/node_modules/twitter-api-v2/dist/cjs/client/index.js:14:1)
at XProvider.generateAuthUrl (/home/user/postiz-app/dist/apps/backend/main.js:3275:24)
at IntegrationsController.getIntegrationUrl (/home/user/postiz-app/dist/apps/backend/main.js:16738:76)
at /home/user/postiz-app/node_modules/@nestjs/core/router/router-execution-context.js:38:29
at /home/user/postiz-app/node_modules/@nestjs/core/router/router-execution-context.js:46:28
at /home/user/postiz-app/node_modules/@nestjs/core/router/router-proxy.js:9:17
GET /launches 200 in 142ms
Error: Invalid consumer tokens
at ClientRequestMaker.buildOAuth (/home/user/postiz-app/node_modules/twitter-api-v2/dist/cjs/client-mixins/request-maker.mixin.js:164:19)
at ClientRequestMaker.initializeToken (/home/user/postiz-app/node_modules/twitter-api-v2/dist/cjs/client-mixins/request-maker.mixin.js:121:32)
at new TwitterApiBase (/home/user/postiz-app/node_modules/twitter-api-v2/dist/cjs/client.base.js:18:32)
at new TwitterApi (/home/user/postiz-app/node_modules/twitter-api-v2/dist/cjs/client/index.js:14:1)
at XProvider.generateAuthUrl (/home/user/postiz-app/dist/apps/backend/main.js:3275:24)
at IntegrationsController.getIntegrationUrl (/home/user/postiz-app/dist/apps/backend/main.js:16738:76)
at /home/user/postiz-app/node_modules/@nestjs/core/router/router-execution-context.js:38:29
at /home/user/postiz-app/node_modules/@nestjs/core/router/router-execution-context.js:46:28
at /home/user/postiz-app/node_modules/@nestjs/core/router/router-proxy.js:9:17
i do also get this warning in docker logs:
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_ACCOUNT_ID not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_ACCESS_KEY not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_SECRET_ACCESS_KEY not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_BUCKETNAME not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_BUCKET_URL not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_REGION not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN Configuration issues found: 6
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_ACCOUNT_ID not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_ACCESS_KEY not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_SECRET_ACCESS_KEY not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_BUCKETNAME not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_BUCKET_URL not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN [Configuration issue] CLOUDFLARE_REGION not set. Needed to setup providers.
[Nest] 181 - 10/16/2024, 8:01:19 PM WARN Configuration issues found: 6
however I have storage set to local Added random cloudflare ids and it didnt make a difference any ideas? can you upload the dockerfile used to build it? that way I can add logging and build the container locally, see if the issue still occurs @Nevo David or does it use the dockerfile.dev one?
Nevo David
Nevo David•3mo ago
I am not sure @xcons created the docker file we will need to wait for his answer
nithur
nithur•3mo ago
I am having the same issues right now clicking on X doesn't redirect to the X auth page instead says Could not connect to the platform
Auxaldeus
Auxaldeus•3mo ago
@Nevo David should I open an issue on github?
nithur
nithur•3mo ago
Hey, I have created one here yesterday: https://github.com/gitroomhq/postiz-app/issues/374
GitHub
Could not connect to the platform when trying to connect X · Issue ...
📜 Description I get the following error when clicking on X icon to connect my X: Could not connect to the platform I have provided my API key and Secret in the .env file. And I have restarted the c...
nithur
nithur•3mo ago
hey @Auxaldeus, adding my domain to x redirect url instead of localhost worked for me
Auxaldeus
Auxaldeus•3mo ago
hmm really? wow you're right maybe that should be made clear in the docs? @Nevo David anyway to have multiple X accounts under a single self hosted server?
nithur
nithur•3mo ago
honestly it surprised me to read they have advised to add localhost redirect url but I thought I am skill issuing so gave it a try
Auxaldeus
Auxaldeus•3mo ago
yeah I thought so too, for some reason I thought it would interact with docker backend as I gave it the benefit of the doubt glad it works now tho thanks
nithur
nithur•3mo ago
I think we should be able to connect to multiple accounts since we have created oauth flow But I am also getting an error when I try to add another account
Auxaldeus
Auxaldeus•3mo ago
I stand corrected
Auxaldeus
Auxaldeus•3mo ago
CleanShot Cloud
CleanShot 2024-10-16 at 12.42.14
Video uploaded to CleanShot Cloud
Auxaldeus
Auxaldeus•3mo ago
Nevo posted this in another thread wait a minute but the 1500 @Nevo David post limit on the free version is for the app not per account
nithur
nithur•3mo ago
did you find a way to connect multiple X accounts? I am getting this error
No description
Nevo David
Nevo David•3mo ago
Can you elaborate on it? In what stage you got it
nithur
nithur•3mo ago
Hey I was able to connect my first X account (from which the developer account was created) When I switch account and connect from Postiz It shows the above error
Nevo David
Nevo David•3mo ago
Mmmm... let me see one moment Let me put all the details from my account
Nevo David
Nevo David•3mo ago
No description
No description
No description
No description
nithur
nithur•3mo ago
It's 10 months old All the settings seems similar to mine
Nevo David
Nevo David•3mo ago
Maybe it's a caching problem, can you maybe try incognito?
nithur
nithur•3mo ago
ok let me try Cool, it worked Thank you so much
Nevo David
Nevo David•3mo ago
@nithur @Auxaldeus you have a mixed support ticket, can I close it?
nithur
nithur•3mo ago
Yes, I have resolved my issues
Auxaldeus
Auxaldeus•3mo ago
Yeah
Support
SupportOP•3mo ago
Hi @Auxaldeus this thread is closed for now, please open a new one if you need more help

Did you find this page helpful?