spring-boot-3.0-security-social-login

By Jason Tzu-Cheng Chuang 2023-01-11

Issue: javax.servlet.http.HttpServletRequest ClassNotFoundException

javax.servlet.http.HttpServletRequest ClassNotFoundException

Purpose

Adding a new Facebook login to an existing form-login app.

We will use the Spring Social support to interact with Facebook and keep things clean and simple.

It leverages facebook OAuth2 to login.

Software version

Java 17

spring boot 3.0.1

spring security 6

thymeleaf-extras-springsecurity6

jakarta.persistence-api

Github Source Code

https://github.com/chuangtc/spring-boot-3.0-security-social-login

Folder structure

Folder structure

Maven Configuration

<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-facebook</artifactId>
    <version>${spring.social.facebook.version}</version>
</dependency>

The Facebook Properties

Next, let's configure Facebook properties in our application.properties:

spring.social.facebook.appId=YOUR_APP_ID
spring.social.facebook.appSecret=YOUR_APP_SECRET

Conclusion

In this quick article, we learned how to use spring-social-facebook to implement a secondary authentication flow for our application.

Relevant Articles:

Reference