GitHub is a community where more than 19 million people learn, share, and work together to build software. GitHub supports OAuth2 authentication which allows glFusion to request GitHub to authenticate a user without exposing the user's password to glFusion.
Configuring GitHub Authentication
You will need to register your website to get started. A registered OAuth application is assigned a unique Client ID and Client Secret. The Client Secret should not be shared. You must have a GitHub account to register a new application / website.
Navigate to https://github.com/settings/applications/new to begin the process.
The New Application Screen will have the following input fields:
- Application name
This is the name that will be displayed on the GitHub Authorization screen that users will see when authenticating with GitHub credentials.
- Homepage URL
The full URL to your glFusion site
- Application description
Provide a description - This is displayed to the user on the GitHub Authorization screen when they use the GitHub authentication for your site.
- Authorization callback URL
You should enter the following: http://www.yoursitehere.com/users.php?oauth_login=github
Be sure to change the www.yoursitehere.com to your domain information.
Click the Register Your Application button and the next screen will be the detailed application page with your Client ID and Client Secret. Be sure to record these numbers as you will need to enter them into the glFusion configuration.
Once you have created the GitHub Oauth keys and access tokens, you will need to enter these into the glFusion Configuration.
Navigate to Command & Control → Users & Submissions
Ensure User Login Method[oauth] is set to True
Set Enable GitHub OAuth Login Method to True
Enter the Client ID from GitHub in the GitHub OAuth Consumer Key field
Enter the Client Secret from GitHub in the GitHub OAuth Consumer Secret field
Select Save Changes
Now you should have GitHub authentication enabled for your site!
Once you have everything setup, when a user selects Login with GitHub they will be presented with a GitHub login screen that has your website name and logo (optional).
Once the user has logged into GitHub, they will be redirected back to your site and automatically be logged in.
The first time a user utilizes the GitHub authentication, they will be presented with an additional authorization screen where they confirm they will share their public profile information with your website (so you can get their name / email).
GitHub Specific Usage Notes
- User's Email Address
GitHub has several security settings that control whether or not a user's email address is publicly exposed. If a user has their profile settings configured so they do not expose an email address, glFusion will not be able to request their password and store it in their local glFusion profile.
- glFusion Username
glFusion will request the user's GitHub user name and use this to create the local glFusion user account profile. If there is already a username that matches, glFusion will automatically add a random number to the end of the GitHub username to make it unique on your site. If you have Allow User name change enabled in glFusion's configuration, the user can change their username to something they prefer.