๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Project/์‹นํ‹”์›€

[์‹นํ‹”์›€] 11/06 ๊ฐœ๋ฐœ์ผ์ง€ Dev ํ™˜๊ฒฝ์— ๋งž๊ฒŒ ์ฝ”๋“œ ์ˆ˜์ •

by ํ•œ33 2024. 11. 10.

๐ŸŒฑ ๋ฐฐ๊ฒฝ

๊ธฐ์กด์— localhost:8080 ์œผ๋กœ ์ฝ”๋“œ๋ฅผ ์งœ๋˜ ๋ฐฉ์‹์—์„œ ๋ฐฐํฌ๋ฅผ ํ•˜๊ฒŒ ๋˜๋ฉด์„œ ๊ธฐ์กด localhost:8080 ์„ window.location.origin ์œผ๋กœ ๋‘๋˜ ์ฝ”๋“œ์—์„œ ๋ชจ๋‘ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

 

๐ŸŒฑ ํ•ด๊ฒฐ์ฑ…

 

์šฐ์„  dev ๋ฒ„์ „๊ณผ local ๋ฒ„์ „์˜ yml ํŒŒ์ผ์„ ๋‚˜๋ˆด๊ณ ,

 

application-local.yml

app:
  domainUri: http://localhost:8080
  redirectUri: "http://localhost:8080/ssaktium/signin/"

application-dev.yml

app:
  domainUri: http://13.124.138.199:8080
  redirectUri: "http://13.124.138.199:8080/ssaktium/signin/"

 

CustomOauthService

@Value("${app.redirectUri}")
private String customRedirectUri;
private String getAccessToken(String provider, String code) {
    String redirectUri = customRedirectUri + provider;
    String url;
    String clientId;
    String clientSecret = null;  // ํ•„์š”ํ•œ ๊ฒฝ์šฐ์—๋งŒ ํ• ๋‹น

 

redirectUri ๋ฅผ dev, local ์— ๋งž๊ฒŒ ์œ ๋™์ ์œผ๋กœ ๋ณ€๊ฒฝ๋˜๋„๋ก ์„ค์ •ํ•ด์คฌ๋‹ค.

 

home.html

if (response.ok) {
    window.location.href = `${window.location.origin}/ssaktium/main`;
successUrl: window.location.origin + "/payments-success?orderRequestId="+orderRequestId,

 

html ํŒŒ์ผ์—์„œ๋„ ์œ„์™€ ๊ฐ™์ด ์„ค์ •์„ ํ•˜๋ฉด ๊ธฐ์กด์˜ ip ์— ๋”ฐ๋ผ์„œ ์•Œ๋งž๊ฒŒ ์œ ๋™์ ์œผ๋กœ ์„ค์ •์ด ๋œ๋‹ค.

 

application.yml

profiles:
  active: local

 

๊ทธ ๋‹ค์Œ local ์ด๋“  dev ๋“  application.yml ์—์„œ ์„ค์ •ํ•ด์ฃผ๋ฉด ๊ทธ์— ๋งž๋Š” ์„ค์ •์œผ๋กœ ๋™์ž‘ํ•œ๋‹ค.