GitHub Client
Last updated
Was this helpful?
Last updated
Was this helpful?
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.
GitHub
Okta
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
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:
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:
Go to your personal settings
Then select Developer Settings, select OAuth Apps and click on New OAuth App
Use Notification-Client as application name
Click on _Register application'
Now you should see the generated values for Client ID and Client Secret
Copy these values over the placeholders in application.yml file
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.
Use as redirect uri
Use as homepage url
No start the main class com.example.github.GitHubClientApplication and browse to .