diff --git a/src/main/java/codesquad/fineants/global/security/oauth/dto/OAuthAttribute.java b/src/main/java/codesquad/fineants/global/security/oauth/dto/OAuthAttribute.java index 1fa7685b4..ba9350d9d 100644 --- a/src/main/java/codesquad/fineants/global/security/oauth/dto/OAuthAttribute.java +++ b/src/main/java/codesquad/fineants/global/security/oauth/dto/OAuthAttribute.java @@ -42,7 +42,7 @@ public static OAuthAttribute of(String provider, Map attributes, private static OAuthAttribute ofGoogle(Map attributes, String nameAttributeKey) { String email = (String)attributes.get("email"); - String profileUrl = (String)attributes.get("picture"); + String profileUrl = (String)attributes.getOrDefault("picture", null); String provider = "google"; String sub = (String)attributes.get("sub"); return new OAuthAttribute(attributes, nameAttributeKey, email, profileUrl, provider, sub); @@ -66,7 +66,7 @@ private static OAuthAttribute ofKakao(Map attributes, String nam private static OAuthAttribute ofNaver(Map attributes, String nameAttributeKey) { Map responseMap = (Map)attributes.get("response"); String email = (String)responseMap.get("email"); - String profileUrl = (String)responseMap.get("profile_image"); + String profileUrl = (String)responseMap.getOrDefault("profile_image", null); String sub = (String)responseMap.get("id"); return new OAuthAttribute(attributes, nameAttributeKey, email, profileUrl, "naver", sub); }