Learn how to implement social login using Google for an existing Spring Boot application using Spring Boot OAuth2 client library. And after successful OAuth2 authentication: Register new user if the user's info does not exist in the database, else update existing user's info.
Here are the steps to code social login with Google:
- Create Google OAuth Credentials
- Configure Spring Security OAuth2 Client
- Update database table & Entity class (add info about authentication provider)
- Update login page
- Code Custom OAuth User & OAuth User Service classes
- Configure Spring Security for OAuth2 authentication
- Implement Authentication Success Handler
- Update CustomerServices: register new / update existing user
Key technologies:
- Spring Boot Web
- Spring Data JPA
- Spring Security
- Spring OAuth2 Client
- Thymeleaf
- Bootstrap & jQuery
- MySQL database
Software programs:
- Java Development Kit (JDK)
- Spring Tool Suite IDE (STS)
- MySQL server & MySQL Workbench
For the companion tutorial, visit: https://www.codejava.net/frameworks/spring-boot/oauth2-login-with-google-example
@CodeJava3 years agoDownload the sample project in this tutorial: 3
@
@yadav117uday2 years agoThis is the most accurate tutorial which did things properly. 1
@
@dmitry14453 years agoThanks for the tutorial. Hi from belarus) 1
@
@janska0294 years agoHi, i need help, my error iscannot be cast toi follow the video but in . 1
@
@ai65663 years agoThank you. This was very informative session.
@
@eugenefeng511last yearThank you for saving me. That' s exact what i want.
@
@hanumantd3 years agoCan you please post database table creation scripts? 1
@
@igorpavlenkov36583 years agoThanks for this tutorial. Hello from russia)
@
@maral-erdenetumursuh48443 years agoHello, thank you for great tutorial. I' ve question about security implementation in micro service project. In cloud gateway can not add dependency. So cannot extendhow i do my filter this kind of architechture. ...Expand
@
@xtrange21526 months agoAnh ci login google em ok r nhng c vn l nu em edit user theo kiu gi myuserdetail ra ly ngi dng ang ng nhp hin ti th n s ra login bng pass vs mk bth th ok ko sao ht vn ch thi. Th phn anh lm l a oauth2detail ring ra nn em ngh l 2 thg n ko phn bit c nhau em user role l admin m login bng n ko hin phn ca admin lun kh o. ...Expand
@
@ethandsa19664 years agoThank you for the tutorial. How do i deny access if the user doesn' t already exist instead of creating a new user?
@
@stevechao40123 years agoThanks for the great tutorial! I was able to log in using g-mail with my original project! and i am able to put g-mail user data in sql server. ...Expand
@
@user-qe2so5vz4t10 months agoAnh i, ti sao trong fle pom ci source code bn di phn miu t a nh km, trong file pom a c nh ny e ang dng java 17 th e thay 17 vo th c li bn ra cn nguyn th chy c l do l g anh nh? Mong c anh reply. ...Expand
@
@trinhquycong.20012 years agoThis tutorial' s great sir, but how can i implement this into a fullstack application, let say spring boot & angular, since it involves rest api, can you give me some advice? Thank you in advance!
@
@HaiNguyen-qm3ft10 months agoTrong trng hp, login with gg th password trong db l null. Vy chc nng change password dnh cho ti khon lm cch no c th s dng vy anh. Em cm n anh.
@
@charagergi53163 years agoI have a question, oauth2 works with a token for authorization, here i can' t see any function for the token. It is managed automatically or we dont use tokens?
@
@tuananhtran43902 years agoAnh c th lm 1 video vi okta m sso c ko:
@
@roan14352 years agoHi nam. I followed almost similar to you what you did in this tutorial. But i' m get and errorcannot be empty" do you have any idea why i' m getting this error?
@
@phamluc26613 years agoI' m newbie with spring boot, having a question can i use the oauth2for mobile app?
@
@David-wf3cclast yearWhere can we get code for front end and other files not included in git. 1
@
@buiucnhan56232 years agoCan you make a video with reactjs as the front end?
@
@ipox00902 years agoCan you tell me where the OAuth2User you wrote is, why can't I see it. Can you help me explain.
@
@rajashekar57554 years agoNam im doing project can you please help me with this, when user enters into my website user should register first and then he needs to be verified by email so that he can login using those crediantials.
@
@tuannguyen-il5oh2 years agoCould you guild to how to force user choose account google to login(when click login with google redirect a page allow choose account google) at video browser get account google we have logined.
@
@user-qe2so5vz4t10 months agoA i lc em download source code v chy th n c bo li l connection refused: no further information em kim tra li thng tin trong file properties k lm ri m c bo v.
@
@shawaalsaif21443 years agoI have two authentication provider google and facebook. As you set authentication provider to google what if the user logs in with facebook?
@
@charagergi53163 years agoHi the video was really helpful, but can i find the source code somewhere? Thank you.
@
@VIVEKSINGH-zk4pv4 years agoHey i am getting error principalities cannot be empty.
@
@arwaalblooshi69444 years agoCan you please do linkedin login? Thanks.
@
@babisvasilopoulos56663 years agoIs any available repository to download the source code.
@
@sanghub16424 years agoPlease helps me. I have problem in classwith error: can' t convertto.
@
@vuvankhiem4783 years agoAnh cho em hi l lm sao ly c avatar v c.
@
@rahilbaig38734 years agoHi, i am getting an error saying " cannot be cast to. 2
@
@masnaswamy40674 years agoJava. Lang. Illegalargumentexception: principalname cannot be empty. How to solve this exception bro.
@
@cuongnguyenminh62353 years agoAnh c chanel bng ting vit ko, em cm n anh.
@
@lokeshdandasena67663 years agoIt was nice that u have provided some information but it seems like u are starting from the middle as you have files in the application before even starting. ...Expand
@
@sagarsri41434 years agoPlease make video on role based login from scratch.
@
@adamdecarte48472 years agoHi, my oauth2user does not have. Getatribute( method. Only&getname(
@
@bennteast17762 years agoCan we please have the full source code, the article doesn' t have all the code needed @codejava. 1
@
@nienpingchen49672 years agoHow can i get the profile photo from facebook orcan i get a photo from keywordthank you so much for all your springboot tutorial, it help me finish my project, so i can start to find a job!. ...Expand
Related videos for Spring Boot OAuth2 Social Login with Google Example:
and i am able to put g-mail user data in sql server . ...Expand
e ang dng java 17 th e thay 17 vo th c li bn ra cn nguyn th chy c
l do l g anh nh? Mong c anh reply. ...Expand
when user enters into my website user should register first and then he needs to be verified by email so that he can login using those crediantials.
connection refused: no further information
em kim tra li thng tin trong file properties k lm ri m c bo v.