[bd] API for XenForo 2.0 2.0.0 Alpha 1

Power up your XenForo installation.

  1. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    pete likes this.
  2. hoangnamdoan33

    hoangnamdoan33 New Member

    add on này dugnf để làm gì anh
     
  3. xfrocks

    xfrocks XenForo rocks!
    Staff Member

  4. Warchamp7

    Warchamp7 Webmaster

    Is this cross compatible with the previous XF1 API @xfrocks or will client applications need to be updated?
     
  5. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    The API is designed to be backward compatible. Client apps shouldn't need updating to work.
     
  6. Warchamp7

    Warchamp7 Webmaster

    Does that mean a XenForo 1 site running your XF1 Consumer add-on can sign in using this XF2 API?
     
  7. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Yes. That's the idea.
     
    Warchamp7 likes this.
  8. Warchamp7

    Warchamp7 Webmaster

    #8 Warchamp7, Mar 27, 2018
    Last edited: Mar 27, 2018
    Just did a test, I'm getting this error during the Authorization flow on my XF2 site

    upload_2018-3-27_3-4-20.png


    • League\OAuth2\Server\Exception\InvalidClientException: API: Client authentication failed.
    • src/addons/Xfrocks/Api/vendor/league/oauth2-server/src/Grant/AuthCodeGrant.php:10
    Generated by: Warchamp7
    Mar 27, 2018 at 3:08 AM

    Stack trace
    Code:
    #0 src/addons/Xfrocks/Api/OAuth2/Server.php(251): League\OAuth2\Server\Grant\AuthCodeGrant->checkAuthorizeParams()
    #1 src/addons/Xfrocks/Api/XF/Pub/Controller/Account.php(106): Xfrocks\Api\OAuth2\Server->grantAuthCodeCheckParams(Object(Xfrocks\Api\XF\Pub\Controller\Account))
    #2 src/XF/Mvc/Dispatcher.php(249): Xfrocks\Api\XF\Pub\Controller\Account->actionAuthorize(Object(XF\Mvc\ParameterBag))
    #3 src/XF/Mvc/Dispatcher.php(89): XF\Mvc\Dispatcher->dispatchClass('XF:Account', 'authorize', 'html', Object(XF\Mvc\ParameterBag), 'account', Object(Xfrocks\Api\XF\Pub\Controller\Account), NULL)
    #4 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
    #5 src/XF/App.php(1891): XF\Mvc\Dispatcher->run()
    #6 src/XF.php(328): XF\App->run()
    #7 index.php(13): XF::runApp('XF\\Pub\\App')
    #8 {main}
    Request state
    Code:
    array(4) {
      ["url"] => string(153) "/account/authorize?client_id=7O-9-6Zq1R&redirect_uri=https%3A%2F%2F--XF1WEBSITE--.com%2Fregister%2Fexternal%3Fprovider%3D3aa36&response_type=code&scope=read"
      ["referrer"] => string(181) "https://--XF2WEBSITE--.com/account/authorize?client_id=7O-9-6Zq1R&redirect_uri=https%3A%2F%2F--XF1WEBSITE--.com%2Fregister%2Fexternal%3Fprovider%3D3aa36&response_type=code&scope=read"
      ["_GET"] => array(5) {
       ["/account/authorize"] => string(0) ""
       ["client_id"] => string(10) "7O-9-6Zq1R"
       ["redirect_uri"] => string(56) "https://--XF1WEBSITE--.com/register/external?provider=3aa36"
       ["response_type"] => string(4) "code"
       ["scope"] => string(4) "read"
      }
      ["_POST"] => array(0) {
      }
    }
     
  9. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    You were able to install it on XenForo 2? Some people are having trouble installing it (MySQL error)... What is your MySQL version?

    Also, client authentication failed means the client id/secret pair is probably incorrect. Are you using the right values for those?
     
  10. Warchamp7

    Warchamp7 Webmaster

    #10 Warchamp7, Mar 27, 2018
    Last edited: Mar 27, 2018
    I didn't have any problem installing. I did an 'Upgrade' in XenForo 2 from bd API 1.4.4 to 2.0.0 Alpha

    MySQL version is 5.5.47. I am definitely using the pair displayed to me on the front end

    upload_2018-3-27_13-16-51.png
     
  11. pete

    pete New Member

    Does this make any sense?

    [27/Mar/2018:22:54:04 +0100] "POST /bbs/api/index.php?batch&oauth_token=0%2C1522187654%2Cd69d4ba6a1dbb60507dabaf1c2034a80%2Chj2h4kocco HTTP/1.1" 404 70 "-" "-"
    [27/Mar/2018:22:54:57 +0100] "POST /bbs/api/index.php?batch&oauth_token=0%2C1522187706%2Cda05fcefff72bac2e8f809166faef714%2Chj2h4kocco HTTP/1.1" 404 70 "-" "-"
    [27/Mar/2018:22:55:18 +0100] "POST /bbs/api/index.php?batch&oauth_token=0%2C1522187728%2Cd88c69df389e9982fa41edec7073fbad%2Chj2h4kocco HTTP/1.1" 404 70 "-" "-"
    [27/Mar/2018:22:56:24 +0100] "GET /bbs/api/ HTTP/1.1" 200 471 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.45 Safari/537.36"
    [27/Mar/2018:22:56:36 +0100] "GET /bbs/api/index.php HTTP/1.1" 200 471 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.45 Safari/537.36"
    [27/Mar/2018:22:56:45 +0100] "GET /bbs/api/index.php?batch HTTP/1.1" 404 70 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.45 Safari/537.36"

    Wordpress consumer just says "Unable to determine API version."
     
  12. Warchamp7

    Warchamp7 Webmaster

    Anything I can modify to get some more verbose logging of what's going wrong on my end xfrocks?

    Your API is super valuable to us and one of two things left for me to test before I upgrade to XF2
     
  13. ciak2009

    ciak2009 Webmaster

    First I'd like to extend a hand of thanks for making such an awesome plugin @xfrocks ! I, like @Warchamp7 heavily rely on this plugin and I am currently running into that same 404 error on many of the XF endpoints. Any assistance is greatly appreciated!
     
  14. Warchamp7

    Warchamp7 Webmaster

    Hey @xfrocks, have you had a chance to look into this at all the last couple weeks?
     
  15. Rayduxz

    Rayduxz Webmaster

    I get this when trying to install it.

    Code:
    XF\Db\Exception: MySQL query error [1709]: Index column size too large. The maximum column size is 767 bytes. src/XF/Db/AbstractStatement.php:212
    Code:
    CREATE TABLE `xf_bdapi_auth_code` (
        `auth_code_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
        `client_id` VARCHAR(255) NOT NULL,
        `auth_code_text` VARCHAR(255) NOT NULL,
        `redirect_uri` TEXT NOT NULL,
        `expire_date` INT UNSIGNED NOT NULL,
        `user_id` INT UNSIGNED NOT NULL,
        `scope` TEXT NOT NULL,
        PRIMARY KEY (`auth_code_id`),
        UNIQUE KEY `auth_code_text` (`auth_code_text`)
    ) ENGINE = INNODB CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
    ------------
    
    #0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1709, 'HY000')
    #1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1709, 'HY000')
    #2 src/XF/Db/AbstractAdapter.php(79): XF\Db\Mysqli\Statement->execute()
    #3 src/XF/Db/Schema/AbstractDdl.php(151): XF\Db\AbstractAdapter->query('CREATE TABLE `x...')
    #4 src/XF/Db/SchemaManager.php(164): XF\Db\Schema\AbstractDdl->apply()
    #5 src/addons/Xfrocks/Api/Setup.php(22): XF\Db\SchemaManager->createTable('xf_bdapi_auth_c...', Object(Closure))
    #6 src/XF/AddOn/StepRunnerInstallTrait.php(60): Xfrocks\Api\Setup->installStep1(Array)
    #7 src/XF/AddOn/StepRunnerInstallTrait.php(27): Xfrocks\Api\Setup->installStepRunner(1, Array)
    #8 src/XF/Admin/Controller/AddOn.php(390): Xfrocks\Api\Setup->install(Array)
    #9 src/XF/Mvc/Dispatcher.php(249): XF\Admin\Controller\AddOn->actionInstall(Object(XF\Mvc\ParameterBag))
    #10 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:AddOn', 'Install', 'html', Object(XF\Mvc\ParameterBag), 'listAddOns', Object(XF\Admin\Controller\AddOn), NULL)
    #11 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
    #12 src/XF/App.php(1891): XF\Mvc\Dispatcher->run()
    #13 src/XF.php(328): XF\App->run()
    #14 admin.php(13): XF::runApp('XF\\Admin\\App')
    #15 {main}
    Code:
    array(4) {
      ["url"] => string(38) "/admin.php?add-ons/Xfrocks-Api/install"
      ["referrer"] => string(63) "https://example/admin.php?add-ons/Xfrocks-Api/install"
      ["_GET"] => array(1) {
        ["add-ons/Xfrocks-Api/install"] => string(0) ""
      }
      ["_POST"] => array(7) {
        ["_xfProcessing"] => string(1) "1"
        ["continue"] => string(1) "1"
        ["confirm"] => string(1) "1"
        ["params"] => string(2) "[]"
        ["count"] => string(1) "1"
        ["finished"] => string(1) "0"
        ["_xfToken"] => string(8) "********"
      }
    }
     
  16. Rayduxz

    Rayduxz Webmaster

    Hey @xfrocks , any ETA for fixing this? To be honest I bought the yearly license just for this :rolleyes:
     
Loading...