nextcloud / nextcloud/integration_gitlab

Avatars of private projects fail to load with OAuth

Open
#8 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
49
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Currently, when using the integration over OAuth with the scopes api, read_user, read_api and read_repository, the project avatars still fail to load with a 401 Unauthorized response by the Gitlab instance.

Version: Nextcloud 20.0.0
PHP: 7.4

Error log:

[index] Error: GuzzleHttp\Exception\ClientException: Client error: `GET https://gitlab.com/uploads/-/system/project/avatar/8711754/gitlab-projectname.png` resulted in a `401 Unauthorized` response:
You need to sign in or sign up before continuing.
 at <<closure>>

 0. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 65
    GuzzleHttp\Exception\RequestException::create(GuzzleHttp\Psr7\Request {}, "*** sensitive parameter replaced ***")
 1. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 203
    GuzzleHttp\Middleware::GuzzleHttp\{closure}("*** sensitive parameters replaced ***")
 2. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 156
    GuzzleHttp\Promise\Promise::callHandler(1, "*** sensitive parameter replaced ***", [GuzzleHttp\Prom ... l])
 3. /var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php line 47
    GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}("*** sensitive parameters replaced ***")
 4. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 246
    GuzzleHttp\Promise\TaskQueue->run(true)
 5. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 223
    GuzzleHttp\Promise\Promise->invokeWaitFn()
 6. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 267
    GuzzleHttp\Promise\Promise->waitIfPending()
 7. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 225
    GuzzleHttp\Promise\Promise->invokeWaitList()
 8. /var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php line 62
    GuzzleHttp\Promise\Promise->waitIfPending()
 9. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php line 183
    GuzzleHttp\Promise\Promise->wait()
10. /var/www/html/lib/private/Http/Client/Client.php line 233
    GuzzleHttp\Client->request("get", "https://gitlab. ... g", {verify: "/var/w ... e})
11. /var/www/html/custom_apps/integration_gitlab/lib/Service/GitlabAPIService.php line 319
    OC\Http\Client\Client->get("https://gitlab. ... g")
12. /var/www/html/custom_apps/integration_gitlab/lib/Controller/GitlabAPIController.php line 85
    OCA\Gitlab\Service\GitlabAPIService->getGitlabAvatar("https://gitlab. ... g")
13. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 169
    OCA\Gitlab\Controller\GitlabAPIController->getGitlabAvatar("https://gitlab. ... g")
14. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 100
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Gitlab\Contr ... "}, "getGitlabAvatar")
15. /var/www/html/lib/private/AppFramework/App.php line 152
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Gitlab\Contr ... "}, "getGitlabAvatar")
16. /var/www/html/lib/private/Route/Router.php line 308
    OC\AppFramework\App::main("OCA\\Gitlab\\Co ... r", "getGitlabAvatar", OC\AppFramework\ ... {}, {action: null,_r ... "})
17. /var/www/html/lib/base.php line 1009
    OC\Route\Router->match("/apps/integration_gitlab/avatar")
18. /var/www/html/index.php line 37
    OC::handleRequest()

GET /apps/integration_gitlab/avatar?url=https%3A%2F%2Fgitlab.com%2Fuploads%2F-%2Fsystem%2Fproject%2Favatar%2F8711754%2Fgitlab-projectname.png
from 147.88.200.100 by Tony at 2020-10-09T09:08:10+00:00

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lib/Service/GitlabAPIService.php line 319, where the avatar request is made, and trace the call from lib/Controller/GitlabAPIController.php line 85. Reproduce the OAuth request for a private project avatar and inspect how authentication is applied to that URL. Done means the avatar loads successfully instead of returning 401 Unauthorized.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.