-
Notifications
You must be signed in to change notification settings - Fork 52
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
Please guide for the next step in XF2. #60
Comments
Once you have got your token, it's quite straight forward:
If you want to create a new thread in a forum, use this https://github.com/xfrocks/bdApi/blob/master/docs/api.markdown#post-threads. The 3 required parameters are curl http://forum.domain.com/community/api/index.php?threads -d 'oauth_token=xxx&forum_id=2&thread_title=Thread+from+api&post_body=Hello+World!' |
By the way, the XenForo 2 version doesn't support creating new thread yet but eventually it will. Both versions (XF1 and XF2) uses the same URL and parameters structure. |
When I am hitting following command using terminal with proper oauth_token -
it is showing me following error -
|
|
1, 3 Thanks for the confirmation. 2 - Oh really.. That's great to know. Please add the email |
I know it's a bit noisy but you can subscribe to this PR #40 to keep track of the api actions for XF2 implementations. I'll close this issue for now. Cheers. |
@daohoangson Having one more query, so opening it again. I am able to create thread in xf2 using API. Thank you! Having one more query - Is if possible to create an oauth token which never expire? Right now, I am doing like this -
But the
|
For never expire token, you can edit the db I think. It's not official
supported.
|
Sorry, But I didn't get it. Which database you are talking about? Do I need to change in any db file? |
Sorry for not being clear. You can change XenForo database, table |
Great! I will change it. |
Hi @daohoangson , Could you please guide me to resolve the error. I will then upgrade to the latest version of the [bd] api |
It stopped working suddenly? |
Yes, Actually I have setup it before in working stage. And now I want to use it. Nothing changed but it is showing me this error. |
should I update it to latest version and then test it again? If yes then I will replace the 'api' and Xfrock(into src folder). and found the new JS folder. should I add the js folder into xf root folder's js directory? |
Yes, please upgrade to the latest version provided here https://xfrocks.com/resources/bd-api-for-xenforo-2-0.36/ |
@daohoangson, I am getting fatal error after upgrade to latest version. Fatal error: Uncaught InvalidArgumentException: Container key 'api.server' was not found in /var/www/website/community/src/XF/Container.php:43 Stack trace: #0 /var/www/website/community/src/XF/App.php(2758): XF\Container->offsetGet('api.server') #1 /var/www/website/community/src/addons/Xfrocks/Api/App.php(77): XF\App->container('api.server') #2 /var/www/website/community/src/XF/Container.php(28): Xfrocks\Api\App->Xfrocks\Api{closure}(Object(XF\Container)) #3 /var/www/website/community/src/XF/App.php(2040): XF\Container->offsetGet('request') #4 /var/www/website/community/src/XF/Error.php(264): XF\App->request() #5 /var/www/website/community/src/XF/Error.php(218): XF\Error->getExceptionTraceHtml(Object(InvalidArgumentException)) #6 /var/www/website/community/src/XF/App.php(1947): XF\Error->displayFatalExceptionMessage(Object(InvalidArgumentException)) #7 /var/www/website/community/src/XF.php(146): XF\App->displayFatalExceptionMessage(Object(InvalidArgumentException)) #8 [internal function]: XF::handleException(Object(InvalidArgumentException)) #9 {main} thrown in /var/www/website/community/src/XF/Container.php on line 43 Please help and suggest |
Have you upgraded the add-on in AdminCP? |
Yes, Forgot to upgrade in admin. |
That error message means your client id/secret pair is not correct. Can you double check those? Also, is your test site accessible on the Internet? I will come by and try it myself. |
Okay. For website access detials, do I send at your email [email protected]? |
@daohoangson Could you please confirm your email address so where I do sent you the access detials of my website? |
@rakeshmali that's my email. Thank you. |
@daohoangson I have sent you the detials at your email address. Please check and suggrest. |
I have received your info. Let's continue over email. |
@daohoangson Not enough permissions to post comments in the XFRocks site for some reason so posting here... I have been successfully using this plugin on my XF2.1 setup for months, but now I am trying to get it setup on another forum and am running into authentication issues: I am able to successfully create an auth token via OAuth2, however, when I then try to use the token, I get the following error:
I have tried on both a regular user and an admin user, both marked as Registered. The only differences between the previous forum and this forum are:
Any ideas what could be happening here? Thank you for all your work! |
Have you tried using |
Edit: created a new token and now it's working with the How come I have to use the query param on this install and I can use the Authorization header in my other forum install? |
Probably some issue with the web server setup. Maybe your proxy (or similar software) truncated the auth header for security reason. It happens sometimes. |
BINGO! I did not think that the headers could be getting stripped. Another difference between the two installs is that the working server is behind nginx and the non-working server is behind apache. Solution here: https://stackoverflow.com/questions/26475885/authorization-header-missing-in-php-post-request Thanks for pointing me in the right direction... 2 days of headaches resolved 😵 |
Thanks for the Stack Overflow link, I didn't know Apache strips that header by default 😨 |
For people who is also having the Fatal error: Uncaught InvalidArgumentException: Container key 'api.server' was not found In my case upgrading didn't work so just enable development mode in the forum config file:
Then go to admin.php?code-events/listeners/ search the BD API app_setup event code listener and change the callback execution order to 9 or less |
That's weird. Sounds like a conflict with some other add-on. Do you mind opening another issue to further debugging? |
Trying to setup following for xf2.x - https://github.com/xfrocks/bdApi/tree/master/php_demo
Authentication successfully done. Getting following message "Obtained access token successfully!" and URLs with tokens.
Now don't know what to do next?
How can I post a thread into a specific forum?
I want to create a post into my XF forum using the api.
I have tried like following but no success - https://domain.com/xf-php-api/index.php?action=request&url=https://forum.domain.com/community/api/index.php?users/me/timeline&oauth_token=TOKEN_CODE&access_token=TOKEN&forum_id=18&thread_title=Thread_Title&post_body=Description
You help will be much appreciated.
The text was updated successfully, but these errors were encountered: