Spring Boot OAuth2 Social Login with Google Example

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2024

ความคิดเห็น • 145

  • @CodeJava
    @CodeJava  3 ปีที่แล้ว +3

    Download the sample project in this tutorial: www.codejava.net/frameworks/spring-boot/oauth2-login-with-google-example

  • @yadav117uday
    @yadav117uday 2 ปีที่แล้ว +1

    this is the most accurate tutorial which did things properly

  • @dmitry1445
    @dmitry1445 3 ปีที่แล้ว +1

    Thanks for the tutorial. Hi from Belarus)

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      Welcome! Greetings from Vietnam :)

  • @eugenefeng511
    @eugenefeng511 ปีที่แล้ว

    Thank you for saving me. That's exact what I want.

    • @CodeJava
      @CodeJava  ปีที่แล้ว

      Glad I could help!

  • @David-wf3cc
    @David-wf3cc ปีที่แล้ว +1

    Where can we get code for front end and other files not included in git

    • @CodeJava
      @CodeJava  ปีที่แล้ว

      in my course on Udemy: www.udemy.com/course/spring-boot-e-commerce-ultimate

  • @sagarsri4143
    @sagarsri4143 4 ปีที่แล้ว +2

    Superb 👌 explanation ✌️

    • @sagarsri4143
      @sagarsri4143 4 ปีที่แล้ว

      Will you please make video on role based logins.

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      including registration (sign up)?

  • @AndresCodifica
    @AndresCodifica 3 ปีที่แล้ว +1

    hi , i need help, my error is oauth2.core.oidc.user.DefaultOidcUser cannot be cast to com.co.rastros.oauth.CustomOAuth2User, i follow the video but in the step CustomOAuth2User oAuth2User = (CustomOAuth2User) authentication.getPrincipal() in the class OAuth2LoginSuccessHandler
    it's not possible, Help.

  • @igorpavlenkov3658
    @igorpavlenkov3658 3 ปีที่แล้ว

    Thanks for this tutorial. Hello from Russia)

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว +1

      Welcome! Greetings from Vietnam :)

    • @Nguyễnkiên-j9s
      @Nguyễnkiên-j9s ปีที่แล้ว

      @@CodeJava em cũng Người Việt ạ

  • @ktn4
    @ktn4 4 ปีที่แล้ว +1

    That's what I need. Many thanks.

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว +1

      You're welcome! Happy learning!

  • @ai6566
    @ai6566 3 ปีที่แล้ว

    Thank You. This was very informative session.

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      Glad it was helpful!

  • @lts8683
    @lts8683 ปีที่แล้ว

    Thanks, please keep going

    • @CodeJava
      @CodeJava  ปีที่แล้ว

      Thank you, I will.

  • @ipox0090
    @ipox0090 2 ปีที่แล้ว

    Can you tell me where the OAuth2User 22:47 you wrote is, why can't I see it. Can you help me explain.

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว

      it is from Spring Security OAuth2 dependency: spring-boot-starter-oauth2-client

    • @ipox0090
      @ipox0090 2 ปีที่แล้ว

      @@CodeJava Thank you.

  • @bennteast1776
    @bennteast1776 2 ปีที่แล้ว +1

    Can we please have the full source code, the article doesn't have all the code needed @CodeJava

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว +1

      You can get the full code if enroll in my course here: www.udemy.com/course/spring-boot-e-commerce-ultimate/?couponCode=SPRING08

    • @bennteast1776
      @bennteast1776 2 ปีที่แล้ว +1

      @@CodeJava can you help me have the customerService class where i can see the logic there

  • @buiucnhan5623
    @buiucnhan5623 2 ปีที่แล้ว

    Can you make a video with Reactjs as the front end?

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว

      Yes, I will.

  • @rahilbaig3873
    @rahilbaig3873 3 ปีที่แล้ว +2

    Hi, I am getting an error saying " org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser cannot be cast to com.bookstore.oauth.CustomOAuth2User" it is occuring on this line ---> "CustomOAuth2User oAuth2User= (CustomOAuth2User) authentication.getPrincipal();
    " it cannot able to cast to CustomOAuth2User.

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      Do you return a CustomOAuth2User object from the method loadUser in the CustomOAuth2UserService class?

    • @rahilbaig3873
      @rahilbaig3873 3 ปีที่แล้ว

      @@CodeJava Hi, I really appreciate for your response.
      when I ran the code in debug mode , I see that CustomOAuth2UserService is not invoking, debug is directly going to OAuth2AuthenticationSuccessHandler. Please advice me, I have pasted the code below. Thanks in advance
      controller:
      @Controller
      public class UserController {
      @RequestMapping("/login")
      public String home() {
      return "login";
      }
      @RequestMapping("/welcome")
      public String welcome(Model model, Principal principal) {
      model.addAttribute("userDetails", principal);
      return "welcome";
      }
      security Config:
      -------------------------
      public class SecurityConfig extends WebSecurityConfigurerAdapter {
      @Autowired
      private CustomOAuth2UserService oauth2UserService;
      @Autowired
      private OAuth2AuthenticationSuccessHandler oauth2AuthenticationSuccessHandler;
      @Override
      protected void configure(HttpSecurity http) throws Exception {
      http.authorizeRequests().antMatchers("/oauth2/**").permitAll().antMatchers("/welcome/**").authenticated()
      .anyRequest().permitAll().and().formLogin().loginPage("/login").and().oauth2Login().loginPage("/login")
      .userInfoEndpoint().userService(oauth2UserService).and()
      .successHandler(oauth2AuthenticationSuccessHandler).and().logout().permitAll().and().rememberMe();
      }
      }
      Service:
      ------------
      @Service
      public class CustomOAuth2UserService extends DefaultOAuth2UserService {
      @Override
      public OAuth2User loadUser(OAuth2UserRequest oAuth2UserRequest) throws OAuth2AuthenticationException {
      OAuth2User oAuth2User = super.loadUser(oAuth2UserRequest);
      return new CustomOAuth2User(oAuth2User);
      }
      }
      OAuth2AuthenticationSuccessHandler
      --------------------------------------------------
      @Component
      public class OAuth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
      @Override
      public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
      Authentication authentication) throws IOException, ServletException {
      // TODO Auto-generated method stub

      CustomOAuth2User oAuth2User=(CustomOAuth2User)authentication.getPrincipal();

      String email=oAuth2User.getEmail();
      System.out.println("Customer's Email"+ email);
      super.onAuthenticationSuccess(request, response, authentication);
      }

      }

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      @@rahilbaig3873 your code seems to be fine. Check if you use @EnableWebSecurity for the config class, and is the dependency spring-boot-starter-oauth2-client present?

    • @aideng5193
      @aideng5193 3 ปีที่แล้ว

      ​@@CodeJava Hello Ty for the tutorial,
      I have the same problem and have been stuck for hours ... I have @EnableWebSecurity for the config class, and the dependency spring-boot-starter-oauth2-client is present.
      Any help please ? :(

    • @aideng5193
      @aideng5193 3 ปีที่แล้ว +1

      CustomOAuth2User : codepad.org/mg8M3n2D
      OAuth2LoginSuccessHandler : codepad.org/hRgg6swS
      CustomOAuth2UserService : codepad.org/IyyV6sat
      Configure Class : codepad.org/su23grlu
      CustomOAuth2User : codepad.org/mg8M3n2D
      Thank you sir

  • @hanumantd
    @hanumantd 3 ปีที่แล้ว +1

    Can you please post database table creation scripts?

  • @HaiNguyen-qm3ft
    @HaiNguyen-qm3ft ปีที่แล้ว

    Trong trường hợp, login with GG thì password trong db là null. Vậy chức năng change password dành cho tài khoản làm cách nào để có thể sử dụng vậy anh. em cảm ơn anh

    • @CodeJava
      @CodeJava  ปีที่แล้ว

      khi đó thì em nên kiểm tra authentication type của user là database thì mới tiến hành đổi mật khẩu.

  • @maral-erdenetumursuh4844
    @maral-erdenetumursuh4844 3 ปีที่แล้ว

    Hello, thank you for great tutorial. I've question about security implementation in micro service project. In cloud gateway can not add spring-boot-starter-web dependency. So cannot extend WebSecurityConfigurerAdapter. How i do my filter this kind of architechture.

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      isn't it spring-boot-starter-security?

  • @ethandsa1966
    @ethandsa1966 4 ปีที่แล้ว

    Thank you for the tutorial. How do I deny access if the user doesn't already exist instead of creating a new user?

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว +1

      Oh, that's not the purpose of social login, which allows users to login using their own google accounts - unanticipated. If you want to deny access in such case, just redirect the user to the login page with an appropriate message: httpResponse.sendRedirect("/login");

    • @ethandsa1966
      @ethandsa1966 4 ปีที่แล้ว

      @@CodeJavaThank you so much for your reply. I'll try that out.

  • @trinhquycong.2001
    @trinhquycong.2001 2 ปีที่แล้ว

    This 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!

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว +1

      I will publish such kind of tutorial in future. Thanks for coming and asking :)

    • @trinhquycong.2001
      @trinhquycong.2001 2 ปีที่แล้ว

      @@CodeJava you're so enthusiastic, hope you do well in this new year!

  • @phamluc2661
    @phamluc2661 3 ปีที่แล้ว

    I'm newbie with Spring Boot, having a question Can I use the OAuth2 authentications for mobile app?

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      I think it's possible though I haven't used it for mobile apps.

  • @lokeshdandasena6766
    @lokeshdandasena6766 3 ปีที่แล้ว

    it 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 to explain, you are not saying anything about the application (i think you have other microservices as well), you should walk through the application so that the purpose should be clear. For example - you have said to add a property to the entity table, I think you are not clearly describing it. please describe it properly so that it will help others.

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      Thanks for your feedback. I understand what you meant. However, the main purpose of video is to show you guys how to integrate social login functionality for an existing Spring Boot application, you it supposes that you already have one.

  • @roan1435
    @roan1435 2 ปีที่แล้ว

    Hi Nam. I followed almost similar to you what you did in this tutorial. But I'm get and error "principalName cannot be empty"... Do you have any idea why i'm getting this error?

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว

      Kindly refer to this Stackoverflow's thread: stackoverflow.com/questions/63352692/spring-security-5-with-oauth2-causing-principalname-cannot-be-empty-error

  • @stevechao4012
    @stevechao4012 3 ปีที่แล้ว

    Thanks 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 DB. But after I log in with Google, the registered account seem do not recognized with my original roles set thus I get a 403 forbidden when I'm using google accounts to login. Can you suggest any leads to combine my original roles set with google accounts?? Thanks a lot!

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว +1

      How do you check the role of a user? You need to update your custom OAuth2User class: update roles in the getAuthorities() method.

    • @stevechao4012
      @stevechao4012 3 ปีที่แล้ว

      @@CodeJava Thanks again ! I manage to get in to the page, but then I found that my Authentication was empty. I use SecurityContextHolder.getContext().getAuthentication() to get user information but it returned null, could it be possible that I have to do something to the JWT that Google sent to
      me ?

  • @charagergi5316
    @charagergi5316 3 ปีที่แล้ว

    I 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?

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      everything is done by Spring OAuth library so we just write some configs then focus on the business logics.

  • @tuannguyen-il5oh
    @tuannguyen-il5oh 2 ปีที่แล้ว

    Could 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

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว

      just customize the login page, display Login with Google button only.

  • @Nguyễnkiên-j9s
    @Nguyễnkiên-j9s ปีที่แล้ว

    anh ơi, tại sao trong fle pom ở cái source code bên dưới phần miêu tả a đính kèm, trong file pom a có để như này
    1.8
    e đang dùng java 17 thì e thay 17 vào thì có lỗi bắn ra còn để nguyên thì chạy được
    lí do là gì anh nhỉ? mong được anh reply ạ

    • @CodeJava
      @CodeJava  ปีที่แล้ว

      có thể là IDE của em chưa hỗ trợ Java 17 chăng?

  • @buukhanhong40
    @buukhanhong40 2 ปีที่แล้ว

    Anh có dạy khoá tiếng Việt không ạ

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว

      ko em ạ. Anh chỉ có khóa tiếng Anh thôi.

  • @Nguyễnkiên-j9s
    @Nguyễnkiên-j9s ปีที่แล้ว

    a ơi lúc em download source code vè chạy thì nó cứ báo lỗi là
    Connection refused: no further information
    em kiểm tra lại thông tin trong file properties kĩ lắm rồi mà cứ báo v

    • @Nguyễnkiên-j9s
      @Nguyễnkiên-j9s ปีที่แล้ว

      a ơi ngoài ide a đang dùng thì a có dùng intellij idea ko ạ

    • @CodeJava
      @CodeJava  ปีที่แล้ว

      Anh có dùng IJ. em có dùng database ko? Kiểm tra javascript error xem.

  • @mjpannu5210
    @mjpannu5210 3 ปีที่แล้ว

    Amazing! Thanks alot

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      You're welcome!

    • @mjpannu5210
      @mjpannu5210 3 ปีที่แล้ว

      @@CodeJava Can you please make a video on how to properly authenticate and authorize requests when I have multiple microservices and we want a single authentication server

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      @@mjpannu5210 Noted your suggestion. I will do it in future because I'm busy making my new course on Udemy this time.

  • @shawaalsaif2144
    @shawaalsaif2144 3 ปีที่แล้ว

    I have two Authentication provider Google and Facebook. As you set authentication provider to google what if the user logs in with facebook?

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      then you have to check provider type in the CustomOAuth2User object (or something else - I don't remember), and update the provider type in database accordingly.

    • @shawaalsaif2144
      @shawaalsaif2144 3 ปีที่แล้ว

      Thank you for replying and this video helped me in understanding oauth2 better and heres how I got that wether the user logged in with fb or gmail
      OAuth2AuthenticationToken oauthToken =
      (OAuth2AuthenticationToken) authentication;
      OAuth2AuthorizedClient client = clientService.loadAuthorizedClient( oauthToken.getAuthorizedClientRegistrationId());

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว +1

      @@shawaalsaif2144 Look at the OAuth2UserRequest class as the parameter of the loadUser() method in a class that implements DefaultOAuth2UserService

  • @43098108
    @43098108 4 ปีที่แล้ว

    Thanks for this!

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      No worries! Glad it helped.

  • @rajashekar5755
    @rajashekar5755 4 ปีที่แล้ว

    NAM 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.

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว +1

      So you can follow the video "Spring Boot Email verification" here: th-cam.com/video/7mVTfnOIJO8/w-d-xo.html

  • @sanghub1642
    @sanghub1642 4 ปีที่แล้ว

    Please helps me. I have problem in class Oauth2LoginSuccessHandler with error: can't convert CustomOauth2User to ....

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      kindly show me the full error/exception here.

    • @sangha1722
      @sangha1722 4 ปีที่แล้ว

      @@CodeJava Full error/exception here:
      java.lang.ClassCastException: org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser cannot be cast to com.example.oauth2Google.entity.CustomOauth2User. Please seen help me!

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      @@sangha1722 You use the wrong type for the CustomOAuth2User class. It should implements the OAuth2User class. Check the video again.

    • @sangha1722
      @sangha1722 4 ปีที่แล้ว

      @@CodeJava My class CustomOAuth2User: "codepad.org/pPNFzKEr".
      And Class Oauth2LoginSuccess: "codepad.org/fvK6mAxM"
      Please seen help me! Thanks.

    • @никитаснигиревич
      @никитаснигиревич 4 ปีที่แล้ว

      @@sangha1722 Did u fix this problem??? i have this error too

  • @VIVEKSINGH-zk4pv
    @VIVEKSINGH-zk4pv 4 ปีที่แล้ว

    Hey I am getting error principalities cannot be empty

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      could you share the full, detailed exception stack trace?

  • @potararaj2642
    @potararaj2642 4 ปีที่แล้ว

    Thankyou Nam ha min

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      Welcome 😊

  • @никитаснигиревич
    @никитаснигиревич 4 ปีที่แล้ว +2

    where is git?

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      Coming soon. I will share the code when I publish a text-based article for the same topic. Thanks for watching :)

    • @dmitry1445
      @dmitry1445 3 ปีที่แล้ว

      @@CodeJava a month has passed and there is no article or gita

  • @charagergi5316
    @charagergi5316 3 ปีที่แล้ว

    Hi the video was really helpful, but can I find the source code somewhere? Thank you

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      source code will be published in a companion article.

  • @babisvasilopoulos5666
    @babisvasilopoulos5666 3 ปีที่แล้ว

    Is any available repository to download the source code

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว +1

      I'll put the code into a separate article, which will be published in near future.

  • @cuongnguyenminh6235
    @cuongnguyenminh6235 3 ปีที่แล้ว

    Anh có chanel bằng tiếng Việt ko ạ, em cảm ơn anh

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      anh chỉ có kênh tiếng Anh này thôi em ạ.

  • @vuvankhiem478
    @vuvankhiem478 3 ปีที่แล้ว

    Anh cho em hỏi là làm sao để lấy được avatar về được ạ

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      look at the attributes in OAUth2User object: oauth2User.getAttribute("name");

  • @AjayGupta-ob8oe
    @AjayGupta-ob8oe 4 ปีที่แล้ว

    Thanks nam

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว +1

      you're welcome. I always remember your request about Spring AOP.

  • @tuananhtran4390
    @tuananhtran4390 2 ปีที่แล้ว

    Anh có thể làm 1 video với Okta mà SSO đc ko ạ :((

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว +1

      khi nào anh có thời gian em ạ.

  • @arwaalblooshi6944
    @arwaalblooshi6944 3 ปีที่แล้ว

    Can you please do Linkedin login? thanks

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      Yes, I will. Thanks for watching :)

  • @masnaswamy4067
    @masnaswamy4067 4 ปีที่แล้ว

    java.lang.IllegalArgumentException: principalName cannot be empty., HOW TO SOLVE THIS EXCEPTION BRO

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      tell me the properties you're using for Spring OAuth configuration.

    • @masnaswamy4067
      @masnaswamy4067 4 ปีที่แล้ว

      security:
      oauth2:
      client:
      registration:
      github:
      client-id: c23e2fe8ec9fdcaa0d21
      client-secret: b81030d3df8c8f51f177427aa627cf21cf007c33
      scope:
      - user:email
      - read:user

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      @@masnaswamy4067why github? are you configuring for google for github?
      for google, the configuration should be like this:
      security:
      oauth2:
      client:
      registration:
      google:
      clientId:
      clientSecret:
      scope:
      - email
      - profile

    • @masnaswamy4067
      @masnaswamy4067 4 ปีที่แล้ว

      @@CodeJava no bro i have configured for GitHub only using github oauth properties .,not google

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      so you need to follow this video: th-cam.com/video/rciM6j3soUs/w-d-xo.html

  • @nilsahyadri
    @nilsahyadri 3 ปีที่แล้ว

    can you send all code or github link.

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      kindly find in the written article at www.codejava.net/frameworks/spring-boot/oauth2-login-with-google-example

  • @sagarsri4143
    @sagarsri4143 4 ปีที่แล้ว

    Please make video on role based login from scratch

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      did you check this video? th-cam.com/video/i21h6ThUiWc/w-d-xo.html

    • @sagarsri4143
      @sagarsri4143 4 ปีที่แล้ว

      @@CodeJava thank u

  • @minhthangngo4431
    @minhthangngo4431 3 ปีที่แล้ว

    Lỗi uỷ quyền thì phải làm sao ạ

    • @CodeJava
      @CodeJava  3 ปีที่แล้ว

      em gửi lỗi chi tiết (exception) được ko?

    • @minhthangngo4431
      @minhthangngo4431 3 ปีที่แล้ว

      @@CodeJava em fix đc rồi anh ạ. thêm cái link uri là đc

  • @sunnysehgal8029
    @sunnysehgal8029 4 ปีที่แล้ว

    Please share the source code

    • @CodeJava
      @CodeJava  4 ปีที่แล้ว

      Kindly follow the video by now because I will publish the code in an article later.

  • @n7-caovanson381
    @n7-caovanson381 3 ปีที่แล้ว

    a ơi giúp e với

  • @adamdecarte4847
    @adamdecarte4847 2 ปีที่แล้ว

    HI, my oAuth2User does not have .getAtribute() method. Only .getAtributes() & .getName()

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว

      Make sure it is from org.springframework.security.oauth2.core.user.OAuth2User. Reference: docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/oauth2/core/user/OAuth2User.html

  • @xtrange2152
    @xtrange2152 ปีที่แล้ว

    Anh ơi cái login google em ok r nhưng có vấn đề là nếu em edit user theo kiểu gọi MyUserDetail ra để lấy người dùng đang đăng nhập hiện tại thì nó sẽ ra null nếu em login bằng pass vs mk bth thì ok ko sao hết vấn đề ở chỗ đó thôi ạ. Thì phần anh làm là a để oauth2detail riêng ra nên em nghĩ là 2 thg nó ko phân biệt đc nhau ạ em để user role là admin mà login bằng nó ko hiện phần của admin luôn khá ảo

  • @nienpingchen4967
    @nienpingchen4967 2 ปีที่แล้ว

    How can i get the profile photo from facebook or google?(oauth2User.getAttribute("name")? can i get a photo from keyword "name"??)
    Thank you so much for all your springboot tutorial, it help me finish my project , so i can start to find a job !

    • @CodeJava
      @CodeJava  2 ปีที่แล้ว

      I think you need to study OAuth2 attributes of Google and Facebook to know which attribute used for user photo image.

    • @nienpingchen4967
      @nienpingchen4967 2 ปีที่แล้ว

      @@CodeJava ok , i will do it , thanks again!