Skip to content

Latest commit

 

History

History
53 lines (49 loc) · 3.39 KB

github.md

File metadata and controls

53 lines (49 loc) · 3.39 KB

:octocat: Signing in users with GitHub

To configure GitHub as an identity provider:

  1. Go to the Identity Platform (Tools -> Identity Platform) page in the Google Cloud console.
  2. Enable Identity Platform. Screenshot: Enable Identity Platform in Google Cloud console
  3. Click Add A Provider. Screenshot: Add a provider in Google Cloud console
  4. Configure sign-in method. Screenshot: GitHub provider in Google Cloud console
    1. Select GitHub from the list
    2. 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 IP 127.0.0.1.
    3. Copy callback URL for the GitHub app configuration.
    4. Client ID and Client Secret are currently not known. Continue with the setup of the GitHub app to get the values.
  5. Navigate to your GitHub account or organizations settings. In the left sidebar, click "Developer settings". Click then "GitHub Apps". Screenshot: GitHub settings
  6. Click "New GitHub App". Screenshot: GitHub developer settings
  7. 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.
  8. 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.
  9. Under "Callback URL", enter the full URL you copied during the Google Cloud identity provider configuration. Screenshot: Register new GitHub app
  10. Under "Permissions" you do not have to select anything. We only want to enable login.
  11. Disable the receive of webhook events, deselect "Active". Under "Where can this GitHub App be installed?", select "Only on this account" account. Screenshot: GitHub app configuration
  12. Click "Create GitHub App".
  13. Generate a new client secret Screenshot: Generate a new GitHub app client secret
  14. Copy Client ID and Client Secret for the Google Cloud identity provider configuration. Screenshot: GitHub app Client ID and Client Secret
  15. Continue the configuration of the Google Cloud identity provider. Screenshot: GitHub app Client ID and Client Secret in Google Cloud console
    1. Paste Client ID from GitHub app.
    2. Paste Client Secret from GitHub app.
    3. Click "Setup Details".
  16. Copy the apiKey and authDomain for your webapp (JavaScript). I use config.js. Screenshot: Google Cloud app configuration settings
  17. Save the GitHub provider.
  18. Done 🎉

You can now start integrating the GitHub provider into your webapp. I have prepared an example with comments: