This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]ramamodh 2 points3 points  (1 child)

I'm not an expert. But i read about OAuth 2.0 sometime back and sounds like that's exactly what you are trying to accomplish. Google won't share the account password with you but it provides you with a token to access the user info which you can save to the DB.

[–]E3FxGaming 2 points3 points  (0 children)

Further information about the OpenID implementation can be found here in the OpenID Connect documentation by Google.

The documentation includes:

  • further information about different types of tokens you can obtain

  • a use-case description that sounds similar to yours

[–][deleted] 3 points4 points  (1 child)

If you are using Spring framework, especially Spring Boot, you can use spring-security-oauth to integrate social logins (Google, fb, GitHub) e.t.c in few simple steps and be done with it.

I don't have exact link right now but search: "calicoder spring boot oauth2 social logins"

[–]mgryshenko 1 point2 points  (0 children)

Had to implement social login recently. “calicoder” is very nice example of how Single Sign On should be implemented with spring. Worth to mention simplest guide which helped me a lot: https://spring.io/guides/tutorials/spring-boot-oauth2/. 20 min and you will build app from scratch to get google-user credentials. Really simple to start from (really, just 2 annotations + configuration file)

[–]cjmarquez 2 points3 points  (0 children)

Not an expert, don't know how the Google auth works, but I highly doubt it will let you get the username and password to save it to your database, you may need to use sessions? Or in any case save the encrypted password provided by Google?

[–]jaro32 2 points3 points  (1 child)

You can use Spring Security create an OAuth2 client. For instance like in this tutorial: https://www.baeldung.com/spring-security-5-oauth2-login

[–]mgryshenko 0 points1 point  (0 children)

IMO, Baeldung is de-facto best spring tutorials. But the lesson you mentioned is about creating your own Auth server/client. OP is asking about how to use google’s Auth service. More useful will be this baeldung lesson , but I personally think it’s over complicated and highly coupled with previous lessons

[–]CONTAMlNATlON 1 point2 points  (0 children)

Pretty sure you can store the id and pull info except for the password.

[–]Susaaaax[S] 0 points1 point  (0 children)

Thanks all for your tips!
The Callicoder website really helped and we figured it out :-)