# Connecting GitHub Login

To let shoppers sign up with a GitHub account, you first register your service with GitHub and receive two values. They are the client ID and the client secret.

This page covers the order in which you receive those two values. Putting the values you received into WEEGLOO is covered in [Putting the values you received into WEEGLOO](#back-to-weegloo).

## The address to copy first {#redirect-uri}

When a shopper finishes logging in at GitHub, GitHub sends the result back to a set address. You have to register this address with GitHub, so copy it first. You paste it in step 1.

Pick your *Space* below and you get the address with the identifier filled in.

```weegloo-redirect-uri
{
  "template": "https://auth.weegloo.com/v1/spaces/{spaceId}/login/oauth2/code/{provider}",
  "provider": "github"
}
```

:::note
If you would rather fill it in yourself, put the identifier of your *Space* in the `{spaceId}` slot. Open that *Space* in the content studio and look at the browser address bar. The value that comes after `/spaces/` is the identifier.

This address is not your site's address. It is where WEEGLOO receives the login result. So it is settled now even if you have not built your site yet. If you turned on **GitHub** in the content studio, the same address appears in **Step 1**, so you can copy it from there.
:::

## Getting the two values from GitHub {#get-credentials}

Sign in to GitHub, then work through the two steps below in order. What you do here costs nothing.

::::step{title="Registering an OAuth App"}
The OAuth that appears on the screens is the name of the method that lets people log in with a GitHub account. The two values are held in this one app you register here.

1. Open the developer settings screen (<https://github.com/settings/developers>).
2. In the left menu, click **OAuth Apps**.
3. Click **New OAuth app**.

   ![The OAuth Apps screen. The left menu holds GitHub Apps, OAuth Apps, and Personal access tokens, the list is empty, and the New OAuth app button is visible](/_img/en-US/getting-started/core-concepts/service-users/service-login/images/github-01-oauth-apps.webp)

4. In **Application name**, enter the name shoppers will see (for example, `Cozy Closet`).
5. In **Homepage URL**, enter your site's address (for example, `https://cozy-closet.com`).
6. In the **Redirect URI** box, paste the address you copied in [The address to copy first](#redirect-uri).
7. Click **Register application**.

   ![The Register a new OAuth app form. Application name holds "Cozy Closet", Homepage URL holds the site address, and Redirect URI holds the WEEGLOO address](/_img/en-US/getting-started/core-concepts/service-users/service-login/images/github-02-register-form.webp)

:::note
If you have not built your site yet, write down the address you plan to use in **Homepage URL**. You can change it later. **Application description** is optional, and what you write is shown to shoppers exactly as written, so write a sentence shoppers will read.
:::
::::

::::step{title="Copying the client ID and the client secret"}
When you click **Register application**, the settings screen of the app you just registered opens. One of the two values, the **Client ID**, is already shown here, and you create the secret now by clicking a button.

1. Copy the value written in **Client ID**.
2. Click **Generate a new client secret** to the right of the **Client secrets** heading.

   ![The app settings screen right after registration. The Client ID value is visible, and the Generate a new client secret button is to the right of the Client secrets heading](/_img/en-US/getting-started/core-concepts/service-users/service-login/images/github-03-client-id.webp)

3. Click the copy icon to the right of the value that was created to copy the secret.

   ![The screen right after the secret is created. The blue notice, the client secret value, and the copy icon are visible](/_img/en-US/getting-started/core-concepts/service-users/service-login/images/github-04-client-secret.webp)

:::note{variant="warning" title="Once you leave this screen you cannot view the secret again"}
**Client ID** stays on this screen, so you can see it again whenever you want. The secret does not. If you lose the secret, create a new one with **Generate a new client secret**, and put the new value into WEEGLOO again. The secret is a secret, exactly as the name says. Do not tell it to anyone, and do not write it down anywhere public.
:::
::::

## Login works only when the email is public {#public-email}

GitHub login carries one condition. The GitHub account logging in has to be making its email public.

When a shopper logs in with GitHub, WEEGLOO receives that account's public email along with it and puts it on the member. In the same *Space*, one email can sign up only once. An account that has not chosen a public email does not hand this value over, and sign-up stops right there.

When it stops, the shopper sees a notice screen that WEEGLOO shows. It says in the shopper's own language that the email could not be retrieved and what to do about it, and it carries a button that goes back to your site.

![The WEEGLOO notice screen saying the email could not be retrieved. It explains the reason and carries a Back to start button](/_img/en-US/getting-started/core-concepts/service-users/service-login/images/login-email-required.webp)

The login result never reaches your site in this case. So your site's code can neither notice this situation nor handle it on the shopper's behalf.

The person who resolves it is the shopper. When the shopper opens **Public profile** in their GitHub account settings (<https://github.com/settings/profile>), there is a **Public email** item. Choosing an email to display there lets every login from then on through. An account that has not chosen one yet shows only **Select a verified email to display**.

![The GitHub profile settings screen. Public profile is selected in the left menu, and the dropdown under Public email shows Select a verified email to display](/_img/en-US/getting-started/core-concepts/service-users/service-login/images/github-05-public-email.webp)

What you can do on your site is write this condition where shoppers log in with GitHub, so they learn about it before they get stuck.

## Putting the values you received into WEEGLOO {#back-to-weegloo}

Now you have the two values in hand. From here the path splits depending on how you have been working so far.

If you were configuring this directly in the content studio, follow these steps.

1. Go back to turning on social login in [Service Member Login](/getting-started/core-concepts/service-users/service-login.md#turning-on-social-login).
2. Turn on **GitHub**.
3. Enter the client ID in the **Client ID** box in **Step 2**.
4. Enter the client secret in the **Client Secret** box.
5. Click **Save**.

If you handed the integration to an AI agent and were told to go and get the values, paste the two values you received into the chat as they are and carry on with what you were doing. The agent handles the rest of the configuration from there.

## What to do next {#what-to-do-next}

- [Service Member Login](/getting-started/core-concepts/service-users/service-login.md): put the values you received into the content studio and finish the rest of the member login configuration.
- [Member Roles and Permissions](/getting-started/core-concepts/service-users/service-user-role.md): create the *ServiceUserRole* that decides what a signed-up member can see and use.
- [Auth API](/api/reference/auth-api.md): covers technical specifications such as the request format you need when wiring login into your own site's code.
