From 84db638ba1fff04887b5d6f16a33621f760a0cc7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 23 Nov 2018 10:24:03 +0300 Subject: Fix google client initialisation --- src/main/java/com/juick/server/api/ApiSocialLogin.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/server/api/ApiSocialLogin.java b/src/main/java/com/juick/server/api/ApiSocialLogin.java index 54a5d1bb..d6a103b4 100644 --- a/src/main/java/com/juick/server/api/ApiSocialLogin.java +++ b/src/main/java/com/juick/server/api/ApiSocialLogin.java @@ -54,6 +54,7 @@ import javax.annotation.PostConstruct; import javax.inject.Inject; import java.io.IOException; import java.security.GeneralSecurityException; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.UUID; @@ -89,8 +90,8 @@ public class ApiSocialLogin { private String VK_SECRET; @Value("${telegram_token:secret}") private String telegramToken; - @Value("${google_client_ids:ids") - private List googleClientIds; + @Value("${google_client_id:}") + private String googleClientId; @Inject private CrosspostService crosspostService; @@ -111,7 +112,7 @@ public class ApiSocialLogin { twitterBuilder = new ServiceBuilder(twitterConsumerKey); vkBuilder = new ServiceBuilder(VK_APPID); verifier = new GoogleIdTokenVerifier.Builder(transport, jsonFactory) - .setAudience(googleClientIds) + .setAudience(Collections.singletonList(googleClientId)) .build(); } @@ -293,7 +294,7 @@ public class ApiSocialLogin { public IdToken.Payload googleSignIn(@RequestParam(name = "idToken") String idTokenString) throws GeneralSecurityException, IOException { logger.info("Token: {}", idTokenString); - logger.info("Clients: {}", googleClientIds); + logger.info("Client: {}", googleClientId); GoogleIdToken idToken = verifier.verify(idTokenString); if (idToken != null) { return idToken.getPayload(); -- cgit v1.2.3