This guide is based on the official "Creating a GitHub App" instructions: https://developer.github.com/apps/building-github-apps/creating-a-github-app We have added more detailed instructions, better screenshots and annotations. So you can get up-and-running even faster!
This guide is checked periodically by the @dwyl team/community, but Github are known to occasionally change their UI/Workflow, so if anything has changed, or there are extra/fewer steps, please let us know!
In your web browser, visit: https://github.com/settings/developers
Click on the "Register a new application" button.
(Note: the button text will be "New OAuth App"
if you already have existing apps)
Ensure that you set the callback URL
to /auth/github/callback
Note: You can edit/change any of these values later.
Click on Register Application
Once your application is successfully created you should see an application settings page similar to this:
Once you have the credentials for your OAuth Client, export them as environment variables so that your Elixir/Phoenix app can access them.
If you are new to environment variables, please see: github.com/dwyl/learn-environment-variables
In our case we add the credentials
to an .env
(environment variables) file.
Locate the Client ID
and Client Secret
on the App settings page.
Copy the values of the Client ID
and Client Secret
and save them as environment variables
GITHUB_CLIENT_ID
and GITHUB_CLIENT_SECRET
respectively.
GITHUB_CLIENT_ID=d6fca75c63daa014c187
GITHUB_CLIENT_SECRET=8eeb143935d1a505692aaef856db9b4da8245f3c
Copy the two keys and export them in your project see: Step 3 of the README.md
⚠️ Don't worry, these keys aren't valid (they were revokedbefore
we published this guide). They are just here for illustration purposes.
When you ship your app to your Production environment, you will need to re-visit steps 3 & 4 to update your app settings URL & callback to reflect the URL where you are deploying your app e.g:
In our case https://elixir-auth-github-demo.herokuapp.com and https://elixir-auth-github-demo.herokuapp.com/auth/github/callback