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

Configuration for Gitea #203

Closed
layanto opened this issue Feb 1, 2020 · 10 comments · Fixed by #204
Closed

Configuration for Gitea #203

layanto opened this issue Feb 1, 2020 · 10 comments · Fixed by #204

Comments

@layanto
Copy link

layanto commented Feb 1, 2020

Vouch stated support for Gitea (#170) but I can't get it to work. Following Gitea oauth docs (https://docs.gitea.io/en-us/oauth2-provider/), I have configured vouch provider as follows:

oauth:

  provider: oidc
  client_id: xxxx
  client_secret: yyyy
  auth_url: https://gitea.example.com/login/oauth/authorize
  token_url: https://gitea.example.com/login/oauth/access_token
  user_info_url: ???
  callback_url: https://vouch.example.com/auth

I don't think Gitea oauth provides user information. If I left out user_info_url from vouch config.yml, I get panic error.

Appreciate help from anyone who managed to get integration with Gitea working. I will then raise PR with example to help the next person.

@layanto
Copy link
Author

layanto commented Feb 2, 2020

Looks like support for Gitea is not working until Gitea supports oauth user info (go-gitea/gitea#8534). Maybe should update couch's readme to not claim support for Gitea and reference Gitea's GitHub issue.

@layanto
Copy link
Author

layanto commented Feb 2, 2020

Until Gitea supports user info, maybe consider adding Gitea as a separate provider without user info similar to IndieAuth, Google and ADFS?

@bnfinet
Copy link
Member

bnfinet commented Feb 2, 2020 via email

@aaronpk
Copy link
Collaborator

aaronpk commented Feb 2, 2020

According to the Gitea docs, the URL to return the current user is /user

https://try.gitea.io/api/swagger#/user/userGetCurrent

If their response from that URL isn't compatible with the current set of things that Vouch understands, it would be relatively simple to create a PR for Vouch to read that format.

@aaronpk
Copy link
Collaborator

aaronpk commented Feb 2, 2020

It looks like Gitea made their /user URL return login and avatar_url just like GitHub, so you should be able to use the GitHub provider and configure it with the Gitea routes

@layanto
Copy link
Author

layanto commented Feb 2, 2020

I will try with GitHub provider later today. But I saw this comment from one Gitea maintainer (I think) that suggested it won't work - go-gitea/gitea#8962 (comment)
But maybe that comment was referring to the implementation of the PR and not necessarily meant vouch with GitHub provider won't work.

@aaronpk
Copy link
Collaborator

aaronpk commented Feb 2, 2020

Ignore that, they're talking about the internal implementation of their new userinfo endpoint.

I just tried it with the following config and it worked:

oauth:
  provider: github
  client_id: XXXXX
  client_secret: XXXXX
  callback_url: http://vouch.example/auth
  auth_url: https://gitea.example/login/oauth/authorize
  token_url: https://gitea.example/login/oauth/access_token
  user_info_url: https://gitea.example/api/v1/user?token=

@bnfinet
Copy link
Member

bnfinet commented Feb 2, 2020 via email

@layanto
Copy link
Author

layanto commented Feb 2, 2020

Tried this and it worked - meaning I can get to my protected app. But how do I check if the user info is retrieved correctly? I checked the header and couldn't find anything relating to the logged in user.

@layanto
Copy link
Author

layanto commented Feb 3, 2020

Confirmed working. I can access Gitea username via $auth_resp_x_vouch_user. Thanks @aaronpk.

@layanto layanto closed this as completed Feb 3, 2020
bnfinet pushed a commit that referenced this issue May 22, 2020
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

Successfully merging a pull request may close this issue.

3 participants