Skip to content

Login problems #16

Description

@riker513

Hi everybody, and thanks for the work!

I'm having problems to log in. It is impossible for me to tell from the documentation or anything I can find online.

How is the workflow meant? I can go to Nextcloud admin settings and link to any one specific user on my GitLab instance. Then for any Nextcloud user, I just need to press the connect button in the respective Nextcloud user's settings, and it works. Howver, now wevery Nextcloud user uses the same GitLab account. How does this make sense? Should I add a Nextcloud account to my Gitlab instance for everybody to use for monitoring purposes?

But if so, why the follwing: If I do NOT enter any Gitlab connection in Nextcloud admin settings, then any user in their respective Nextcloud user's settings have the option to enter a personal access token. This does not work: If I create a personal access token for that user in GitLab and enter it in Nextcloud, the connection is not possible. I anyways ask myself why there is no option to specify a GutLab username. So how is this supposed to work?

Kind regards and many thanks!
riker

Activity

  1. Th3Ph4nt0m commented on Feb 18, 2021

    @Th3Ph4nt0m

    Having a similar problem. I cannot find any documentation for this integration. In my nextcloud admin settings, I cannot find any settings for the GtiLab integration.

  2. julien-nc commented on Feb 18, 2021

    @julien-nc
    Member

    Hi,

    Sorry for the lack of documentation.

    @riker513

    Howver, now wevery Nextcloud user uses the same GitLab account.

    If you've configure an OAuth app for a GitLab instance and your users use the OAuth flow to connect to it, they connect with their GitLab user. The only thing that is shared between Nextcloud users is the OAuth app they use to access GitLab.

    If I create a personal access token for that user in GitLab and enter it in Nextcloud, the connection is not possible.

    Did you add "api", "read_user", "read_api" and "read_repository" permissions to the personal token? What happens when you enter the token in user connected account settings?

    I anyways ask myself why there is no option to specify a GutLab username. So how is this supposed to work?

    A token is enough to authenticate a user. No need to specify a username when providing a personal token. Actually, when using the OAuth flow, an OAuth access token is created and is also used without username.

    @Th3Ph4nt0m

    In my nextcloud admin settings, I cannot find any settings for the GtiLab integration.

    Do you mean there is a "Connected accounts" admin settings section but it does not contain a GitLab subsection?
    You should check for error in the browser console (F12 -> console tab).
    Are you using an old browser (more than 3 years)? Some modern javascript syntax is used. Here is the browser compatibility list:
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining#browser_compatibility

  3. Th3Ph4nt0m commented on Feb 18, 2021

    @Th3Ph4nt0m

    Do you mean there is a "Connected accounts" admin settings section but it does not contain a GitLab subsection?

    This is not in the admin settings, it's in the user settings. This works. There should be some instructions in how to use the integration when enabling it, otherwise many users will instantly remove the App because they don't know how to set it up.

  4. added 2 commits that reference this issue on Feb 18, 2021
  5. riker513 commented on Feb 23, 2021

    @riker513
    Author
    Howver, now wevery Nextcloud user uses the same GitLab account.
    

    If you've configure an OAuth app for a GitLab instance and your users use the OAuth flow to connect to it, they connect with their GitLab user. The only thing that is shared between Nextcloud users is the OAuth app they use to access GitLab.

    If I create a personal access token for that user in GitLab and enter it in Nextcloud, the connection is not possible.
    

    Did you add "api", "read_user", "read_api" and "read_repository" permissions to the personal token? What happens when you enter the token in user connected account settings?

    I anyways ask myself why there is no option to specify a GutLab username. So how is this supposed to work?
    

    A token is enough to authenticate a user. No need to specify a username when providing a personal token. Actually, when using the OAuth flow, an OAuth access token is created and is also used without username.

    Hi @eneiluj
    I still don't get this.
    1.) If I create a system OAuth Token in Gitlab with AppId and Secret, then I can enter this in the Admin settings in Nextcloud. When I log out of Nextcloud and bback in weith a normal user, I can go to settings for the normal user and simply click Connect to GitLab. No further token or anything is requested and it just says: Connected as root. Same for every other user: Always connected as root. What sense does that make? Everybody will receive root's Gitlab notifications.

    2.) If I instead don't enter anything in the admin settings in Nextcloud and log back in as a normal user, then the normal user DOES have the option to enter one personal access token. (But then connection doesn't work.) So the question is: Why can't the normal user enter any token in his settings if Nextcloud is connected to Gitlab via the admin settings? If he can't enter any token, how would we distinguish one user from the other?

    Cheers

  6. julien-nc commented on Feb 23, 2021

    @julien-nc
    Member

    Let me try to explain this from the beginning. 😁

    With this app, there are 2 ways to authenticate a Nextcloud user in a GitLab instance:

    • The user creates a personal token (taking care of setting suggested permissions) and puts it in user settings
    • The Nextcloud admin creates an OAuth app in a GitLab instance and puts the client ID/secret in Nextcloud admin settings. Then Nextcloud users can hit the "connect" button (if they choose the GitLab instance configured in admin settings) and they are redirected to GitLab authentication page. If they authenticate successfully (or if a GitLab session already exists), they are redirected to Nextcloud with an OAuth token.

    In Nextcloud admin settings, what you enter is not an access token, it's only an OAuth app client ID/secret that will be used to let users authenticate in a GitLab instance.

    No further token or anything is requested and it just says: Connected as root. Same for every other user: Always connected as root.

    What happens here is that your "root" session in GitLab is alive so when you press "connect" in Nextcloud, you reach GitLab authentication page that lets you in because you are already authenticated. I mean, your browser is already authenticated.

    Don't worry, other users won't be able to login as root. They will just see the GitLab authentication page. Try to logout from your GitLab account (on the GitLab website) and press "connect" in Nextcloud user settings.

    About 2. Are you sure you've added correct permissions to the token you manually created? I didn't get any bug report about that not working for the moment. Maybe you did something wrong or maybe there is a problem that only shows up in your context. In this case I would need more information like Nextcloud log messages when entering the token.

    Any better?

  7. vincowl commented on Mar 9, 2021

    @vincowl

    I am facing a similar problem : when using a personal token, the token is rejected as an incorrect one. Permissions are correctly set and other tokens work perfectly with gitlab and other apps such as Labcoat. Any idea ?
    Nextcloud : 21.0.0
    Gitlab integration app : 0.0.15
    Gitlab : 13.9

  8. farrad commented on Jan 16, 2022

    @farrad

    Same here, neither of the two methods work for me.

    Here is my step-by-step:

    1. When User settings are empty (via OAuth app)

    I do the following:
    a. In GitLab (e.g. https://gitlab.domain.com): go to Menu --> Admin --> Applications --> New application
    b. Fill-in the fields as follows:

    c. Press Save application button
    d. Copy Application ID and Secret
    e. In Nextcloud Settings: Go to the Administration --> Connected accounts --> GitLab integration section
    f. Fill-in the fields as follows:

    • OAuth app instance address: https://gitlab.domain.com
    • Application ID: Enter from the step d.
    • Application secret: Enter from the step d.

    g. Hit Tab. "GitLab admin options saved" message appears (HTTP response: 1)
    h. Go to the Personal --> Connected accounts --> GitLab integration section

    • GitLab instance address field contains https://gitlab.com
    • Personal access token is empty

    i. Go to the Dashboard (https://nextcloud.example.com/apps/dashboard/#/)
    j. In the GitLab todos card click on the Connect to GitLab button. I get redirected to the Personal --> Connected accounts --> GitLab integration page

    2. When Admin settings are empty (via pesonal token)

    I do the following:
    a. Go to the Personal --> Connected accounts --> GitLab integration section
    b. Fill-in the fields as follows:

    • GitLab instance address: https://gitlab.domain.com
    • Personal access token: <personal token with the 'api', 'read_user', 'read_api', 'read_repository' permissions>
    • Enable navigation link checked OR unchecked

    c. Hit Tab. "Incorrect access token" message appears

    HTTP Request:

    {"values":{"token":"<TOKEN_HERE>","url":"https://gitlab.domain.com"}}
    

    HTTP Response:

    {"user_name":""}
    

    My environment

    Nextcloud: 23.0.0.1
    GitLab: 14.4.1

  9. Sim0nW0lf commented on Feb 16, 2022

    @Sim0nW0lf

    I tried this as well, just like @farrad and had exactly the same issue

  10. lerd2805 commented on Feb 23, 2022

    @lerd2805

    i have the same issue like @farrad. when gonna have any update to get fix this bug?

  11. CodingKitsune commented on May 15, 2022

    @CodingKitsune

    Still broken on NextCloud 24 and GitLab 14.10.2

  12. wenlong1234 commented on May 27, 2022

    @wenlong1234

    i have the same issue , can you help fix it?

  13. julien-nc commented on May 30, 2022

    @julien-nc
    Member

    It's working fine on my side with integration_gitlab v1.0.3. I tried using an OAuth app with a gitlab.com and framagit.org account. I also tried using a personal token for both these servers.

    Could someone check if some lines containing "GitLab API error" pop up in the Nextcloud server logs (nextcloud/data/nextcloud.log) when trying to set a personal token in the Connected accounts settings section?

    If this does not help, could someone create an account for me on a Gitlab instance where the issue was observed? You can send me the credentials by email (which you can find in every commit of this repo). I could look into this issue if I could reproduce it 😁.

  14. farrad commented on Jun 11, 2022

    @farrad

    @eneiluj Thank you for testing this!

    I was finally able to resolve it.

    Short answer:
    Add 'allow_local_remote_servers' => true, to your Nextcloud config

    Detailed answer:
    Here is what I did:

    1. With integration_gitlab v1.0.3 it was still not working for me (NC: 23.0.5 GitLab: 14.4.1)
    2. I repeated Step 1(a-g) from my previous post. It worked exactly the same way as before.
    3. I executed Step 1h and the page contained Gitlab instance address: https://gitlab.domain.com/ (NOT https://gitlab.com/) and no field for a personal token. Instead there was a button Connect to GitLab.
    4. I pressed the button I was redirected to https://gitlab.domain.com/ and then back to the Personal --> Connected accounts page (account was still not connected). In browser console I noticed that the Nextcloud URL I was actually redirected to was /settings/user/connected-accounts?gitlabToken=error&message=Error+getting+OAuth+access+token.+Host+violates+local+access+rules
    5. After googling for "GitLab OAuth Host violates local access rules" I was able to find this answer to a similar question.
    6. I added this line: 'allow_local_remote_servers' => true, to the Nextcloud config: <WEBROOT>/config/config.php. Then restarted Nextcloud and repeated Step 1h.
    7. Now I was redirected back to Nextcloud with a different message: /settings/user/connected-accounts?gitlabToken=success and saw that GitLab integration is now connected.
    8. Going to the Dashboard I saw GitLab issues displayed in the GitLab Integration Widget.

    My suggestion is to explicitly describe this Nextcloud setting in the Configuration section.

  15. gb-123-git commented on Jun 21, 2022

    @gb-123-git

    +1

    I am facing the same problem. Adding 'allow_local_remote_servers' => true, did not fix it for me.

    Log Says : {"reqId":"hxxxxxxxxb","level":2,"time":"2022-06-22T02:34:40","remoteAddr":"1xx.1xx.xxx.xx3","user":"xxxxx","app":"integration_gitlab","method":"GET","url":"/apps/integration_gitlab/todos","message":"GitLab API error : cURL error 28: Connection timed out after 30001 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://xxx.xxx.xxx/api/v4/todos?action%5B%5D=assigned&action%5B%5D=mentioned&action%5B%5D=build_failed&action%5B%5D=marked&action%5B%5D=appr.....}

  16. LightTemplar commented on Jul 18, 2022

    @LightTemplar

    Show answer: Add 'allow_local_remote_servers' => true, to your Nextcloud config

    Thanks, this also worked for me!
    And, if someone here uses Nextcloud on Univention system as me, you can set that variable also via following command:
    sudo univention-app shell nextcloud sudo -u www-data php /var/www/html/occ config:system:set allow_local_remote_servers --value=true --type=boolean

  17. Cris70 commented on Jun 14, 2024

    @Cris70

    Worked for me also (I was having the Host violates local access rules error in the log).
    It's 2024 and this is still not clearly outlined in the Gitlab Integration setup page, why?

  18. Cris70 commented on Jun 14, 2024

    @Cris70

    I am facing the same problem. Adding 'allow_local_remote_servers' => true, did not fix it for me.

    Log Says : {"reqId":"hxxxxxxxxb","level":2,"time":"2022-06-22T02:34:40","remoteAddr":"1xx.1xx.xxx.xx3","user":"xxxxx","app":"integration_gitlab","method":"GET","url":"/apps/integration_gitlab/todos","message":"GitLab API error : cURL error 28: Connection timed out after 30001 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://xxx.xxx.xxx/api/v4/todos?action%5B%5D=assigned&action%5B%5D=mentioned&action%5B%5D=build_failed&action%5B%5D=marked&action%5B%5D=appr.....}

    At first, adding allow_local_remote_servers worked for me, but after a few hours it stopped working wihtout any apparent reason.
    Trying to reinstate the connection, now I get a timeout just like @gb-123-git.

  19. Cris70 commented on Dec 17, 2025

    @Cris70

    A year has passed, I gave another shot at this extension.
    First of all: re-reading the whole thread, I see @julien-nc suggests giving the "api", "read_user", "read_api", "read_repository" permissions. However, the "api" permission is not listed in the Nextcloud configuration page fot Gitlab integration. And actually it is quite dangerous, as it gives full R/W access to the API.
    Anyway, even giving "api" permission is not enough to make this extension work.
    Looking at the NC logs, I am getting this error:

    {
      "reqId": "3Y65EufklxMbVxcoZzQv",
      "level": 2,
      "time": "2025-12-17T12:52:10+01:00",
      "remoteAddr": "CENSORED",
      "user": "CENSORED",
      "app": "integration_gitlab",
      "method": "POST",
      "url": "/apps/integration_gitlab/account",
      "message": "GitLab API error : Client error: `GET https://cloud.CENSORED.com/api/v4/user` resulted in a `404 Not Found` response:\n<!DOCTYPE html>\n<html class=\"ng-csp\" data-placeholder-focus=\"false\" lang=\"en\" data-locale=\"en\" translate=\"no\" >\n\t<head\n  (truncated...)\n",
      "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36",
      "version": "31.0.12.3",
      "data": {
        "app": "integration_gitlab"
      },
      "id": "694299a8df521"
    }

    If I remove the "api" permission, I get a timeout:

    {
      "reqId": "x3kXPBPRYlJP4DE81ZKO",
      "level": 2,
      "time": "2025-12-17T12:41:09+01:00",
      "remoteAddr": "CENSORED",
      "user": "CENSORED",
      "app": "integration_gitlab",
      "method": "POST",
      "url": "/apps/integration_gitlab/account",
      "message": "GitLab API error : cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://git.CENSORED.com/api/v4/user",
      "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36",
      "version": "31.0.12.3",
      "data": {
        "app": "integration_gitlab"
      },
      "id": "69429c9d6b21f"
    }
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

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions