> For the complete documentation index, see [llms.txt](https://andifalk.gitbook.io/openid-connect-workshop/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://andifalk.gitbook.io/openid-connect-workshop/intro-labs/github-client.md).

# GitHub Client

This introduction lab shows how easy you can use one of the well-known OAuth2/OIDC provider like GitHub, Google or Facebook with Spring Security.

Spring Security provides the class *CommonOAuth2Provider* containing predefined configurations for setting up one of these providers in your client application.

* Google
* GitHub
* Facebook
* Okta&#x20;

These predefined configurations already include the base configuration settings for the different providers, so you just have to configure your application-specific parts.

For details please see the corresponding section in the [spring security reference doc](https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#oauth2login-common-oauth2-provider)

This lab implements a simple client to display notifications for the GitHub user who will authorize this client to use his/her GitHub credentials.

The relevant OAuth2 configuration part is quite simple and is located in *application.yml* file:

```
spring:
  security:
    oauth2:
      client:
        registration:
          github:
            client-id: <client_id>
            client-secret: <client_secret>
            scope:
              - read:user
              - notifications
            redirect-uri: '{baseUrl}/login/oauth2/code/{registrationId}'
```

As you can see there are placeholders or *client\_id* and *client\_secret*. To get these credentials you need a GitHub account, after logging into your account:

1. Go to your personal settings&#x20;
2. Then select *Developer Settings*, select *OAuth Apps* and click on *New OAuth App*
3. Use *Notification-Client* as application name
4. Use <http://localhost:9090/login/oauth2/code/github> as redirect uri
5. Use <http://localhost:9090> as homepage url
6. Click on \_Register application'
7. Now you should see the generated values for *Client ID* and *Client Secret*
8. Copy these values over the placeholders in *application.yml* file

No start the main class *com.example.github.GitHubClientApplication* and browse to [localhost:9090](http://localhost:9090).

After you log in into GitHub you should see the user attributes, and you should be able to get the notifications by clicking on the button at the top of the screen.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://andifalk.gitbook.io/openid-connect-workshop/intro-labs/github-client.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
