Add Github Login


# Add Github Login

You can add Github login to your applications using Asgardeo and enable users to log in with their Github account.

Follow this guide for instructions.

# Register Asgardeo on Github

You need to register Asgardeo as an OAuth app on Github.

You can follow the Github documentation (opens new window) for detailed instructions.

  1. Log in to Github (opens new window), click your profile icon, and click Settings.

  2. On the left panel of the Settings page, click Developer settings.

  3. Under OAuth apps, click Register a new application. Register oauth2 app in Github

  4. Give the application a name and the following URLs:

    • Homepage URL
       https://api.asgardeo.io/t/{organization_name}
      
      1
    • Authorization callback URL
      https://api.asgardeo.io/t/<organization_name>/commonauth
      
      1
    Enter Github app details
  5. Click Register application.

  6. Generate a new client secret and take note of the Client ID and Client secret.

# Register the Github IdP

Now, let's register the Github IdP in Asgardeo.

  1. On the Asgardeo console, go to Develop > Connections.

  2. Click New Connections and select Github.

  3. Enter the following details and click Finish:

    Add Github IDP in Asgardeo
    Parameter Description
    Name A unique name for this Github identity provider.
    Client ID The client ID obtained from Github.
    Client secret The client secret obtained from Github.
  4. If required, you can disable JIT user provisioning.

After the Github identity provider is created, go to the Settings tab and see the list of scopes to which Github has granted permissions.

  • email: Grants read access to a user's primary email address.
  • public_profile: Grants read access to a user's default public profile details.

Asgardeo needs these scopes to get user information. Asgardeo checks the attribute configurations of the application and sends the relevant attributes received from Github to the app. You can read the Github Documentation (opens new window) to learn more.

# Enable Github login

Before you begin

You need to have an application registered in Asgardeo. If you don't already have one, register one of the following application types:

  1. On the Asgardeo console, go to Develop > Applications.

  2. Open your application from the list and go to the Sign-in Method tab.

  3. If you haven't already defined a sign-in flow, click Start with Default configuration to get started.

  4. Click Add Authentication on the step, select your Github identity provider, and click Add.

    Add Github login in Asgardeo

# Try it out

Follow the steps given below.

  1. Access the application URL.
  2. Click Login to open the Asgardeo login page.
  3. On the Asgardeo login page, Sign in with Github.
Login with Github
  1. Log in to Github with an existing user account.

When a user successfully logs in with Github for the first time, a user account is created in the Asgardeo console with the Github username. This new user account will be managed by Github.