From 2801b6cd352da7605618b7d3f13f46336d1c6308 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Thu, 22 Feb 2024 11:06:17 +0100 Subject: [PATCH] Customize: Add GitHub authentication integration --- docs/customize/authentication.md | 40 ++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/docs/customize/authentication.md b/docs/customize/authentication.md index 881ceb99..2db0312d 100644 --- a/docs/customize/authentication.md +++ b/docs/customize/authentication.md @@ -66,10 +66,10 @@ After having registered a new client application in the ORCID website and having the plugin and configuring key and secret. In your `invenio.cfg`: ```python -from invenio_oauthclient.contrib import orcid +from invenio_oauthclient.contrib.orcid import REMOTE_APP as ORCID_REMOTE_APP OAUTHCLIENT_REMOTE_APPS = dict( - orcid=orcid.REMOTE_APP, + orcid=ORCID_REMOTE_APP, ) ORCID_APP_CREDENTIALS = dict( @@ -83,6 +83,42 @@ See the plugin [documentation](https://invenio-oauthclient.readthedocs.io/en/latest/usage.html#module-invenio_oauthclient.contrib.orcid) for more information. +#### GITHUB + +To integrate GitHub authentication into InvenioRDM, follow the steps below: + +- Register a New GitHub Application by Navigating to GitHub's [New OAuth Application page](https://github.com/settings/applications/new) to create a new OAuth application. +Provide the necessary details with special attention to the `Homepage URL` and `Authorization callback URL`, which should match your InvenioRDM instance's callback URL format: + +```cfg +Homepage URL: https://127.0.0.1 +Authorization callback URL: https://127.0.0.1/oauth/authorized/github +``` + +Change `https://127.0.0.1` to `SITE_UI_URL` in the `invenio.cfg` file to reflect your actual site URL. + +After registration, GitHub will provide a `Client ID` and `Client Secret`. These credentials are essential for the OAuth integration. + +- Configure GitHub login in InvenioRDM by enabling the plugin and add the key and secret. In your `invenio.cfg`: + +```python +from invenio_oauthclient.contrib.github import REMOTE_APP as GITHUB_REMOTE_APP + +# Setup Github Authentication +# =========================== + +GITHUB_APP_CREDENTIALS = dict( + consumer_key="", + consumer_secret="", +) + +OAUTHCLIENT_REMOTE_APPS = dict( + github=GITHUB_REMOTE_APP, +) +``` + +If you encounter any issues, or if a `302` appears in your logs, seek help through this [resource](https://docs.github.com/en/apps/oauth-apps/maintaining-oauth-apps/troubleshooting-authorization-request-errors) or join the discussion on [discord](https://discord.gg/8qatqBC) for support. + #### Keycloak [Keycloak](https://www.keycloak.org/) is an open-source solution for identity management