Nextcloud as auth source #3396

Closed
opened 2025-11-02 05:11:40 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @poVoq on GitHub (May 29, 2019).

Description

Would be cool if your own Nextcloud instance would work with Oauth2/OIDC like requested by someone else here:
https://discourse.gitea.io/t/nextcloud-as-an-oauth2-authentication-source/1119

When trying to do it with the generic OIDC it results in a 500 error as apparentl the .well-known stuff is not working.

Details on the Nextcloud sinde of things can be found here:
https://docs.nextcloud.com/server/16/admin_manual/configuration_server/oauth2.html
Its a quite new feature and might not work quite like expected.

Thanks for looking into it!

Originally created by @poVoq on GitHub (May 29, 2019). ## Description Would be cool if your own Nextcloud instance would work with Oauth2/OIDC like requested by someone else here: https://discourse.gitea.io/t/nextcloud-as-an-oauth2-authentication-source/1119 When trying to do it with the generic OIDC it results in a 500 error as apparentl the .well-known stuff is not working. Details on the Nextcloud sinde of things can be found here: https://docs.nextcloud.com/server/16/admin_manual/configuration_server/oauth2.html Its a quite new feature and might not work quite like expected. Thanks for looking into it!
GiteaMirror added the issue/confirmedtype/feature labels 2025-11-02 05:11:40 -06:00
Author
Owner

@lafriks commented on GitHub (May 29, 2019):

It should be easy to add as library we use (https://github.com/markbates/goth) does already support nextcloud

@lafriks commented on GitHub (May 29, 2019): It should be easy to add as library we use (https://github.com/markbates/goth) does already support nextcloud
Author
Owner

@stale[bot] commented on GitHub (Jul 28, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jul 28, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@poVoq commented on GitHub (Jul 28, 2019):

any chance this might still make it into 1.9.0?

@poVoq commented on GitHub (Jul 28, 2019): any chance this might still make it into 1.9.0?
Author
Owner

@lunny commented on GitHub (Jul 29, 2019):

1.9.0 has been freezed and currently there is no PR for this.

@lunny commented on GitHub (Jul 29, 2019): 1.9.0 has been freezed and currently there is no PR for this.
Author
Owner

@Turakar commented on GitHub (Aug 15, 2019):

I would also be interested in this :)

@Turakar commented on GitHub (Aug 15, 2019): I would also be interested in this :)
Author
Owner

@fazlerabbi37 commented on GitHub (Oct 1, 2019):

@Turakar did you start working on this?

@fazlerabbi37 commented on GitHub (Oct 1, 2019): @Turakar did you start working on this?
Author
Owner

@Turakar commented on GitHub (Oct 1, 2019):

Nope, chronic lack of free time ^^ With my small user base, creating separate accounts on both services was ok.

@Turakar commented on GitHub (Oct 1, 2019): Nope, chronic lack of free time ^^ With my small user base, creating separate accounts on both services was ok.
Author
Owner

@wioxjk commented on GitHub (Nov 12, 2019):

I am also very interested in this feature

@wioxjk commented on GitHub (Nov 12, 2019): I am also very interested in this feature
Author
Owner

@githubkoma commented on GitHub (Mar 1, 2020):

Some more Info:

I already tried to use the GitLab-OAuth2-Template, but that fails because of the following:

  1. This is the first not-working step when getting the user object, as the token is sent as URL-Parameter instead of Bearer-Token in Header:

Gitea Log:
2020/02/29 12:13:52 routers/user/auth.go:590:handleOAuth2SignIn() [E] UserSignIn: Nextcloud responded with a 401 trying to fetch user information

oauth2 gitea not working

1.1 In Comparison how it looks like for Rocket.Chat as OAuth client, where it works:

oauth2 rocketchat working

  1. This is the JSON String that the user-endpoint of nextcloud sends back if authenticated successfuly (i am not sure if the escapes in storageLocation are because of extracting this from wireshark..):
{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"storageLocation":"\/var\/www\/html\/data\/dummy","id":"dummy","lastLogin":1583084839000,"backend":"LDAP","subadmin":["self-registered"],"quota":{"free":2832472,"used":12896168,"total":15728640,"relative":81.99,"quota":15728640},"email":"dummy@gmail.com","phone":"","address":"","website":"","twitter":"","groups":["paid-users"],"language":"en","locale":"","backendCapabilities":{"setDisplayName":false,"setPassword":true},"display-name":"dummy"}}}
@githubkoma commented on GitHub (Mar 1, 2020): Some more Info: I already tried to use the GitLab-OAuth2-Template, but that fails because of the following: 1) This is the first not-working step when getting the user object, as the token is sent as URL-Parameter instead of Bearer-Token in Header: Gitea Log: ```2020/02/29 12:13:52 routers/user/auth.go:590:handleOAuth2SignIn() [E] UserSignIn: Nextcloud responded with a 401 trying to fetch user information``` ![oauth2 gitea not working](https://user-images.githubusercontent.com/5107805/75631231-66503580-5bf1-11ea-9d73-cc966b8caee8.PNG) 1.1 In Comparison how it looks like for Rocket.Chat as OAuth client, where it works: ![oauth2 rocketchat working](https://user-images.githubusercontent.com/5107805/75631217-52a4cf00-5bf1-11ea-8e99-1a021d30d14b.PNG) 2) This is the JSON String that the user-endpoint of nextcloud sends back if authenticated successfuly (i am not sure if the escapes in storageLocation are because of extracting this from wireshark..): ``` {"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"storageLocation":"\/var\/www\/html\/data\/dummy","id":"dummy","lastLogin":1583084839000,"backend":"LDAP","subadmin":["self-registered"],"quota":{"free":2832472,"used":12896168,"total":15728640,"relative":81.99,"quota":15728640},"email":"dummy@gmail.com","phone":"","address":"","website":"","twitter":"","groups":["paid-users"],"language":"en","locale":"","backendCapabilities":{"setDisplayName":false,"setPassword":true},"display-name":"dummy"}}} ```
Author
Owner

@githubkoma commented on GitHub (Mar 3, 2020):

<3 @lafriks @techknowlogick

@githubkoma commented on GitHub (Mar 3, 2020): <3 @lafriks @techknowlogick
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3396