-
Notifications
You must be signed in to change notification settings - Fork 168
GitHub Integration: Initial Set up
Cheng Geng edited this page Jun 15, 2021
·
1 revision
In order for GitHub integration to function, the appropriate environment variables must be set.
This will allow the user to log-in to GitHub through the website, authenticating the website through the GitHub API.
SourceAcademy makes use of the OAuth workflow for authenticating a log-in. The following steps are taken when the user attempts to log-in through SourceAcademy.
- SourceAcademy opens a pop-up directed to GitHub client of our application.
- The GitHub client redirects back to the GitHub callback page of SourceAcademy with an access code.
- The GitHub callback page sends the access code to our OAuth proxy.
- The OAuth proxy then exchanges the access code with GitHub in order to get an auth token.
- The auth token is then sent back to our callback page.
- With the auth token, we are able to complete the log-in.
- Open the
.env
file - Set
REACT_APP_GITHUB_CLIENT_ID
to the client ID. - If you are unsure of the client ID, please navigate to Settings > Developer Settings for the SourceAcademy organization.
There you should be able to find the OAuth apps. If you are deploying locally for testing, use Localhost client ID. If you are deploying for public use, use the GitHub Pages client ID.
- Set
REACT_APP_GITHUB_OAUTH_PROXY_URL
tohttps://api2.sourceacademy.nus.edu.sg/github_oauth
.