Gitea: What's to be set as Authorization callback URL for a github authentication?

Created on 29 Jan 2018  Â·  6Comments  Â·  Source: go-gitea/gitea

Description

the docs seem to lack information how the Authorization callback URL has to be configured when setting up a GitHub application as authentication backend (https://github.com/settings/applications/…). i'll amend it to the docs when resolved.

kinquestion

Most helpful comment

Hi Guys,

I have just successfully added my Gitea installation so that you can login using github credentials.

Its very similar to how Jenkins is done and heres the solution.

First login to github and create a new Github app for your org.

Next use the following:

GitHub App name (mgmt.example.com/git)
Homepage URL (https://mgmt.example.com/git).
User authorization callback URL (https://mgmt.example.com/git/user/oauth2/github/callback)
Webhook URL (https://mgmt.example.com/git)

Save the changes and create the private key.

Note: Webhook URL shouldn't be needed but wasn't accepting without putting something in here.

Next install the github app.

This concludes the github part.

Note: When asked to give permissions to the GitHub app, you only need Organization members found under Permissions section and Emails under Users section. Both of these should be set to read only.

Now login to your gitea install https://mgmt.example.com/git and goto site administration. Add a new authentication source and use the following details.

Authentication Name (github)
OAuth2 Provider (GitHub)
Client ID (Key) (enter your ID found on your GitHub app you created)
Client Secret (enter your Secret found on your GitHub app you created)

Now active the changes and open a private browser window and try logging into your Gitea install. It should now have an option to login as GitHub user, select this and enter your github creds, it then should ask you to login with your usual Gitea creds so that it can link. This only needs to be done once.

Thats all folks, enjoy GitHub based auth :)

All 6 comments

Have not tried but looking at source it should be <YOUR_ROOT_URL>/oauth2/<PROVIDER_NAME>/callback

I remember there a tip on the configuration UI?

sorry, but my deployment setup changed and it will not include such sunctionality, so can't give feedback whether @lafriks's hint is correct.

I remember there a tip on the configuration UI?

no, there was none, but it would be good to have that.

Hi Guys,

I have just successfully added my Gitea installation so that you can login using github credentials.

Its very similar to how Jenkins is done and heres the solution.

First login to github and create a new Github app for your org.

Next use the following:

GitHub App name (mgmt.example.com/git)
Homepage URL (https://mgmt.example.com/git).
User authorization callback URL (https://mgmt.example.com/git/user/oauth2/github/callback)
Webhook URL (https://mgmt.example.com/git)

Save the changes and create the private key.

Note: Webhook URL shouldn't be needed but wasn't accepting without putting something in here.

Next install the github app.

This concludes the github part.

Note: When asked to give permissions to the GitHub app, you only need Organization members found under Permissions section and Emails under Users section. Both of these should be set to read only.

Now login to your gitea install https://mgmt.example.com/git and goto site administration. Add a new authentication source and use the following details.

Authentication Name (github)
OAuth2 Provider (GitHub)
Client ID (Key) (enter your ID found on your GitHub app you created)
Client Secret (enter your Secret found on your GitHub app you created)

Now active the changes and open a private browser window and try logging into your Gitea install. It should now have an option to login as GitHub user, select this and enter your github creds, it then should ask you to login with your usual Gitea creds so that it can link. This only needs to be done once.

Thats all folks, enjoy GitHub based auth :)

@soakes your knowledge is certainly better re-usable if added to the docs. ;-)

Will see what I can do when I get a few minutes or someones welcome to add for us.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jorise7 picture jorise7  Â·  3Comments

Fastidious picture Fastidious  Â·  3Comments

kolargol picture kolargol  Â·  3Comments

thehowl picture thehowl  Â·  3Comments

tuxfanou picture tuxfanou  Â·  3Comments