I’ve been trying to set up login with nextcloud
but when I log in with my nextcloud account it just does nothing. I’ve changed the auth source from local to nextcloud. In nextcloud I used this as the URL,
https://gitea.example.com/login/oauth/authorize
but that doesn’t work so I tried just https://gitea.example.com/
neither log me into my account. What do I do?
jake
April 5, 2023, 2:27pm
2
The callback configured in Nextcloud should be https://gitea.example.com/user/oauth2/<Authentication Name>/callback
.
This https://gitea.example.com/login/oauth/authorize
URL is for when Gitea is acting as the OAuth provider not the consumer.
ok tried that it still gave me a 500 code, can you tell me where the log files would be for gitea as nextcloud log files don’t give me much
I guess you encounter this problem:
opened 05:31PM - 05 Apr 23 UTC
kind/bug
### Description
Many users reported this problem: when they try to use OAuth2… as auth source, they see 500 errors, and an unclear error message in log:
```
/auth/oauth.go:920:SignInOAuthCallback() [E] [642b21e7-2] UserSignIn: oauth2: server response missing access_token
```
The problem is that:
1. If the user double-click and copy the secret from GitHub app page, there will be an extra space in the Client Secret field.
2. The incorrect Client Secret makes the auth failed. GitHub returns clear message
3. However, the goth package doesn't respect the error message, it only returns an error "server response missing access_token"
To fix the problem:
1. Trim spaces.
2. Fix goth package, make it respect the returned error message.
3. Make Gitea show more details if goth returns unclear messages, at least it helps users.