![]() |
VOOZH | about |
Spring Security provides seamless integration with OAuth2 providers like GitHub, Google or Facebook. This allows developers to enable Single Sign-On (SSO) and let users log in with their GitHub account instead of managing custom login forms and credentials.
OAuth2 is an industry-standard protocol for authorization. Instead of creating separate credentials for every app, users can log in with a trusted provider (like GitHub) and allow your application to use certain information.
1. Go to GitHub -> Settings -> Developer settings -> OAuth Apps.
2. Click New OAuth App.
3. Fill in the details:
4. Register the app and copy: Client ID & Client Secret.
Use Spring Initializr and create spring boot project
Select:
Note: This dependency is mandatory for OAuth2 authentication. Without it, GitHub login will not work even if Spring Security is present.
Add your credentials in application.yml:
Create a controller class for define endpoint
index.html:
welcome.html
Spring Boot auto-configures OAuth2 login, so you don’t need a custom SecurityConfig.