Skip to content
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

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

Open
gurbain opened this issue Aug 25, 2021 · 3 comments
Open

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

gurbain opened this issue Aug 25, 2021 · 3 comments

Comments

@gurbain
Copy link

gurbain commented Aug 25, 2021

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!

@gurbain
Copy link
Author

gurbain commented Sep 9, 2021

Up! :)

@julien-nc
Copy link
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.

@gurbain
Copy link
Author

gurbain commented Sep 16, 2021

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants