flexiodata / flexio-web-app

Flex.io Web App
https://www.flex.io/app
MIT License
5 stars 2 forks source link

BUG: Connections API: Connecting to a public GitHub repo without authenticating with OAuth2 fails #550

Closed dzwillia closed 5 years ago

dzwillia commented 5 years ago

(You will want to have your developer tools open for these steps)

  1. Go to the connections area
  2. Click "New" in the sidebar
  3. Select "GitHub" as the connection type you'd like to create
  4. Click the "Authenticate your GitHub Account" button
  5. Enter "flexiodata" and "functions-currency" (which is a public repo) for the "owner" and "repository", respectively.
  6. Click "Create Connection"

Works perfectly. The connection status is set to "Connected" and shows a green checkmark.

Now, repeat those steps, omitting step 4:

  1. Go to the connections area
  2. Click "New" in the sidebar
  3. Select "GitHub" as the connection type you'd like to create
  4. Enter "flexiodata" and "functions-currency" (which is a public repo) for the "owner" and "repository", respectively.
  5. Click "Create Connection"

Fails to connect (the /connect call returns with HTTP status code 422). The HTTP response is included below. The connection status is still "Not Connected" and shows a red X (even though the connection can still be queried -- you'll not the file list still shows).

{
    "error": {
        "code": "connection-failed",
        "message": "Could not connect",
        "type": "flexio exception",
        "module": "/media/sf_flexio/application/api/Connection.php",
        "line": 253,
        "debug_message": "{\"code\":\"connection-failed\",\"message\":null}",
        "trace": "#0 /media/sf_flexio/application/api/Api.php(343): Flexio\\Api\\Connection::connect(Object(Flexio\\Api\\Request))\n#1 /media/sf_flexio/application/api/Api.php(315): Flexio\\Api\\Api::processRequest(Object(Flexio\\Api\\Request))\n#2 /media/sf_flexio/application/controllers/ApiController.php(30): Flexio\\Api\\Api::request(Object(Flexio\\System\\FrameworkRequest))\n#3 [internal function]: Flexio\\Controllers\\ApiController->indexAction()\n#4 /media/sf_flexio/application/system/Framework.php(326): call_user_func_array(Array, Array)\n#5 /media/sf_flexio/application/system/Framework.php(571): Flexio\\System\\FxControllerAction->invokeAction('api', 'index')\n#6 /media/sf_flexio/application/bootstrap.php(382): Flexio\\System\\Framework->dispatch()\n#7 /media/sf_flexio/public/index.php(16): Flexio->run()\n#8 {main}"
    }
}
dzwillia commented 5 years ago

@alwillia Is this fixed? The connection UI has actually been updated since this bug report and now there is no way to actually create a "public" GitHub repo connection.

alwillia commented 5 years ago

Yes, this is now fixed, and I verified it using the API. We recently added a connection interface to services that expose a connect() function, which is invoked through the api call, and each service now implements this function.