Skip to content

Commit b7bbee4

Browse files
authored
fix: Google 인증 디버깅 추가 (#84)
1 parent 679fc6c commit b7bbee4

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

backend/src/main/java/com/back/BackApplication.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
package com.back;
22

3-
import com.google.api.client.util.Value;
3+
import com.google.auth.oauth2.GoogleCredentials;
44
import jakarta.annotation.PostConstruct;
5+
import org.springframework.beans.factory.annotation.Value;
56
import org.springframework.boot.SpringApplication;
67
import org.springframework.boot.autoconfigure.SpringBootApplication;
78
import org.springframework.cache.annotation.EnableCaching;
89
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
910
import org.springframework.scheduling.annotation.EnableAsync;
1011

12+
import java.io.FileInputStream;
13+
import java.nio.file.Path;
14+
import java.nio.file.Paths;
15+
1116
@SpringBootApplication
1217
@EnableJpaAuditing
1318
@EnableCaching
@@ -22,7 +27,18 @@ public static void main(String[] args) {
2227

2328
@PostConstruct
2429
public void setGoogleCredentialsEnv() {
25-
// Google SDK가 사용할 수 있도록 환경변수 세팅
26-
System.setProperty("GOOGLE_APPLICATION_CREDENTIALS", googleCredentialsPath);
30+
Path path = Paths.get(googleCredentialsPath).toAbsolutePath();
31+
System.setProperty("GOOGLE_APPLICATION_CREDENTIALS", path.toString());
32+
System.out.println("*** Google credentials path set to: " + path);
33+
34+
try (FileInputStream serviceAccountStream = new FileInputStream(path.toFile())) {
35+
GoogleCredentials credentials = GoogleCredentials.fromStream(serviceAccountStream);
36+
37+
System.out.println("*** Google credentials loaded successfully!");
38+
System.out.println("*** Credentials type: " + credentials.getClass().getSimpleName());
39+
} catch (Exception e) {
40+
System.err.println("*** Failed to load Google credentials: " + e.getMessage());
41+
}
2742
}
43+
2844
}

0 commit comments

Comments
 (0)