# GitHub as OAuth2 Provider
In the following example configuration we will implement GitHub as OAuth provider.
You will require GitHub credentials and a GitHub developer account for configuration.
# 1: Register New App in GitHub
- To register a new app, open the GitHub developer console (opens new window) and go to
OAuth Apps
. - Make the following settings:
Field | Value |
---|---|
Application name | Name of your application, e.g. "4ALLPORTAL" |
Homepage URL | Enter the full URL, e.g. "https://example.4allportal.net" |
Application description | Optional description |
Authorization callback URL | Enter the callback URL, e.g. "https://example.4allportal.net/oauth/login/{providerName}" |
Please note: The provider name required for field Authorization callback URL
is created in the next step and can be replaced here later.
# 2: 4ALLPORTAL Basic Configuration
In the 4ALLPORTAL, navigate to admin snap-in Authentication/OAuth configurations
. Click Create in the toolbar.
The following basic settings are required for a GitHub provider:
- Give your provider a name (e.g. github). This name later replaces
{providerName}
in GitHub fieldAuthorization callback URL
.- Naming rules: Please do not use special characters (allowed are: a - z, A - Z, numbers and underscore
_
)
- Naming rules: Please do not use special characters (allowed are: a - z, A - Z, numbers and underscore
- In field Base URL, enter your domain name (without
/
at the end). - Enable field visible.
- Select a default role and a default language for the users logging in with this provider.
- In section Mapping of user fields you can add the following configuration:
CoreEngine Field | External Field | Overwrite |
---|---|---|
friendlyname | name | true |
firstname | name | true |
ext_id | id | false |
true | ||
username | name | true |
# 3: 4ALLPORTAL OAuth2 Specific Configuration
The following OAuth2 specific settings are required for a GitHub provider:
- In field Client ID, enter your Client ID
- In field Client secret, enter your Client secret
- In field Access token URI, enter
https://github.com/login/oauth/access_token
. - In field User authorization URI, enter
https://github.com/login/oauth/authorize
. - In field User info URI, enter
https://api.github.com/user
. - In section
Scopes
, adduser
.
We have added scope "user" to the User info URI. You can as well add other scopes, compare the GitHub docs (opens new window) for details.
Example configuration in the GUI
# 4: Complete Configuration
- Save your 4ALLPORTAL configuration and restart the system.
- In the GitHub-side configuration, replace
{providerName}
with your stored provider name in fieldAuthorization callback URL
.
# Troubleshooting
In case you had some issues with receiving user data, please refer the GitHub user response docs (opens new window).