To configure GitHub as an identity provider:
- Go to the Identity Platform (Tools -> Identity Platform) page in the Google Cloud console.
- Enable Identity Platform.
- Click Add A Provider.
- Configure sign-in method.
- Select GitHub from the list
- Register your app's domains (in my example the GitHub Page
gcloud-identity.nkn-it.de
) by clicking "Add Domain" under Authorized Domains. For development purposes,localhost
is already enabled by default. I added additional the local IP127.0.0.1
. - Copy callback URL for the GitHub app configuration.
- Client ID and Client Secret are currently not known. Continue with the setup of the GitHub app to get the values.
- Navigate to your GitHub account or organizations settings. In the left sidebar, click "Developer settings". Click then "GitHub Apps".
- Click "New GitHub App".
- Under "GitHub App name", enter a name for your app.
You should choose a clear and short name. Your app's name (converted to lowercase, spaces replaced by
-
) will be shown in the user interface when your app takes an action. - Under "Homepage URL", type the full URL to your app's website. If you don’t have a dedicated URL you can use the URL of the organization or user that owns the app.
- Under "Callback URL", enter the full URL you copied during the Google Cloud identity provider configuration.
- Under "Permissions" you do not have to select anything. We only want to enable login.
- Disable the receive of webhook events, deselect "Active". Under "Where can this GitHub App be installed?", select "Only on this account" account.
- Click "Create GitHub App".
- Generate a new client secret
- Copy Client ID and Client Secret for the Google Cloud identity provider configuration.
- Continue the configuration of the Google Cloud identity provider.
- Paste Client ID from GitHub app.
- Paste Client Secret from GitHub app.
- Click "Setup Details".
- Copy the
apiKey
andauthDomain
for your webapp (JavaScript). I useconfig.js
. - Save the GitHub provider.
- Done 🎉
You can now start integrating the GitHub provider into your webapp. I have prepared an example with comments: