Skip to content

Error getting OAuth access token. cURL error 7: Failed to connect #28

Description

@gurbain

Hi,

I've set up a gitlab and nextcloud instance using docker-compose (behind a plesk proxy that redirect http to https) on my server recently and I am quite happy with them. However, I struggle a bit with the gitlab integration app in nextcloud.

Basically, I've followed the instructions and created an application on gitlab, called "Nextcloud" and with the following permissions
Screenshot from 2021-08-26 00-04-18

On nextcloud, I've filled the app ID and secret keys as informed, but when I try to connect my user, I get the following error message:
Error connecting to GitLab: Error getting OAuth access token. cURL error 7: Failed to connect to git.XXXX.com port 443: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://git.XXXX.com/oauth/token

Screenshot from 2021-08-26 00-04-50

I don't see much more information on the server logs or in the console so I'm a bit confused how to debug this issue.
Screenshot from 2021-08-26 00-06-44

As a test, I've tried manual curl calls to https://git.XXXX.com/api/v4/user in a terminal (at different locations) but get a 404 error, although I receive an response when I type this address in firefox directly. I can also see the request on the nginx logs from the gitlab docker:
192.168.128.1 - - [25/Aug/2021:22:30:12 +0000] "GET /oauth/authorize?client_id=XXX&redirect_uri=https%3A%2F%2Ffiles.XXXX.com%2Fapps%2Fintegration_gitlab%2Foauth-redirect&response_type=code&state=z160x7sz4&scope=api%20read_user%20read_api%20read_repository HTTP/1.0" 302 221 "" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0" -

Does anyone have an idea? Thank you!

Activity

  1. gurbain commented on Sep 9, 2021

    @gurbain
    Author

    Up! :)

  2. julien-nc commented on Sep 13, 2021

    @julien-nc
    Member

    Hi, so apparently, the server side of your Nextcloud instance can't reach your GitLab instance. It's expected to get an error when requesting /api/v4/user because the CURL request is not authenticated. You may try to reach /api/v4/projects for proper testing.

    Are your Nextcloud and GitLab instances on the same machine?
    Could you get inside the Nextcloud server container and run the following command?

    host git.XXXX.com
    

    Your issue is very specific to your setup. I don't think I can provide much help. You'll have to investigate why the Nextcloud -> GitLab requests are failing.

  3. gurbain commented on Sep 16, 2021

    @gurbain
    Author

    Hi @eneiluj,

    Thank you for your feedback!

    I am indeed running the two instances on the same machine! They are simply running in different docker containers. The only "specific" configuration in my setup is the use of traefik as a reverse proxy, but in a way this is also quite common.

    The result of host in the nextcloud container gives:

    host git.XXX.com
    git.XXX.com has address PRIVATE_IP_OF_THE_DOCKER_COTAINER
    

    When I do the same in a shell remotely, I obtain:

    host git.XXX.com
    git.XXX.com has address PUBLIC_IP_OF_MY_SERVER
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions