Przeglądaj źródła

240809-1752-Kim

hokky 3 miesięcy temu
rodzic
commit
ecd41152e6

+ 82 - 0
pro/app/Http/Controllers/Auth/SocialTalkController copy 2.php

@@ -0,0 +1,82 @@
+<?php
+namespace Themes\kbgolf\pro\app\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use Illuminate\Support\Facades\Redirect;
+use SocialiteProviders\Apple\Provider;
+use Laravel\Socialite\Facades\Socialite;
+use Laravel\Socialite\Two\GoogleProvider;
+use Laravel\Socialite\Two\FacebookProvider;
+use SocialiteProviders\Kakao\KakaoProvider;
+use App\Providers\Socialite\OAuth2\DaboryProvider;
+use SocialiteProviders\Naver\Provider as NaverProvider;
+use Illuminate\Http\Request;
+
+class SocialTalkController extends Controller
+{
+    private $appleTokenService;
+    private $oauth2Info;
+    private $target;
+
+    public function redirectToProvider($provider)
+    {
+        $this->oauth2Info = request('oauth2Info');
+        // dump($this->oauth2Info);
+        return $this->setConfig($provider, request('target'))->redirect();
+    }
+
+    public function login($provider)
+    {
+        [$this->target, $ssoBrand] = explode('-', $provider);
+        if ($this->target == 'member') {
+            if ($ssoBrand == 'naver') {
+                return Redirect::away('https://talk.naver.com/ct/w5u3g9');
+            }elseif($ssoBrand == 'kakao'){
+                return Redirect::away('https://pf.kakao.com/_aAAGj/chat');
+            }
+        }
+    }
+
+    public function setConfig($provider, $target)
+    {
+        $config = [
+            'client_id' => $this->oauth2Info['ClientId'],
+            'client_secret' => $this->oauth2Info['ClientSecret'],
+            'redirect' => "/social/$target-$provider/callback"
+        ];
+
+        switch ($provider) {
+            case 'dabory':
+                $driver = Socialite::buildProvider(DaboryProvider::class, [
+                    'client_id' => config('app.api.main.ClientId'),
+                    'client_secret' => config('app.api.main.ClientSecret'),
+                    'redirect' => $config['redirect']
+                ]);
+                break;
+            case 'facebook':
+                $driver = Socialite::buildProvider(FacebookProvider::class, $config);
+                break;
+            case 'kakao':
+                $driver = Socialite::buildProvider(KakaoProvider::class, $config);
+                break;
+            case 'google':
+                $driver = Socialite::buildProvider(GoogleProvider::class, $config);
+                break;
+            case 'naver':
+                $driver = Socialite::buildProvider(NaverProvider::class, $config);
+                break;
+            case 'apple':
+
+                $config['client_secret'] = $this->appleTokenService->generate(
+                    $this->oauth2Info['PrivateKey'],
+                    $this->oauth2Info['ClientId'],
+                    $this->oauth2Info['TeamId'],
+                    $this->oauth2Info['KeyId'],
+                );
+
+                $driver = Socialite::buildProvider(Provider::class, $config);
+                break;
+        }
+        return $driver;
+    }
+}

+ 136 - 0
pro/app/Http/Controllers/Auth/SocialTalkController copy.php

@@ -0,0 +1,136 @@
+<?php
+namespace Themes\kbgolf\pro\app\Http\Controllers\Auth;
+
+use App\Http\Controllers\Controller;
+use App\Services\CallApiService;
+use Illuminate\Support\Facades\Redirect;
+use SocialiteProviders\Apple\Provider;
+use Laravel\Socialite\Facades\Socialite;
+use Laravel\Socialite\Two\GoogleProvider;
+use Laravel\Socialite\Two\FacebookProvider;
+use SocialiteProviders\Kakao\KakaoProvider;
+use App\Providers\Socialite\OAuth2\DaboryProvider;
+use App\Services\AppleTokenService;
+use SocialiteProviders\Naver\Provider as NaverProvider;
+use Illuminate\Http\Request;
+
+class SocialTalkController extends Controller
+{
+    private $appleTokenService;
+    private $callApiService;
+    private $oauth2Info;
+    private $target;
+
+    public function __construct(CallApiService $callApiService, AppleTokenService $appleTokenService)
+    {
+        $this->callApiService = $callApiService;
+        $this->appleTokenService = $appleTokenService;
+    }
+
+    public function redirectToProvider($provider)
+    {
+        $this->oauth2Info = request('oauth2Info');
+        // [$this->target, $ssoBrand] = explode('-', $provider);
+
+        $brandCode = 'member-'.$provider;
+        $response = $this->callApiService->callApi([
+            'url' => 'setup-page',
+            'data' => [
+                'PageVars' => [
+                    'Query' => "(setup_code = 'sso-client' and brand_code = '{$brandCode}') and is_on_use = '1'",
+                    'Limit' => 100
+                ]
+            ],
+        ]);
+        // dd($this->oauth2Info);
+        // dd($response);
+        if (!empty($response['Page'])) {
+            $setupJson = $response['Page'][0]['SetupJson'];
+            // dd($setupJson);
+            $setupArray = json_decode($setupJson, true);
+            $redirectUri = route('social.login', ['provider' => $brandCode]);
+            if (json_last_error() === JSON_ERROR_NONE) {
+                $clientId = $setupArray['ClientId'] ?? null;
+                // dd($clientId);
+            }
+        }
+
+        if ($provider == 'naver') {
+            $url = 'https://nid.naver.com/oauth2.0/authorize?' . http_build_query([
+                'response_type' => 'code',
+                'client_id' => $clientId,
+                'redirect_uri' => $redirectUri,
+                'state' => csrf_token(),
+            ]);
+        } elseif ($provider == 'kakao') {
+            $url = 'https://kauth.kakao.com/oauth/authorize?' . http_build_query([
+                'response_type' => 'code',
+                'client_id' => $clientId,
+                'redirect_uri' => $redirectUri,
+                'state' => csrf_token(),
+            ]);
+        }
+        // dd($url);
+        return redirect($url);
+    }
+
+    public function login($provider)
+    {
+        // dd($provider);
+        [$this->target, $ssoBrand] = explode('-', $provider);
+        if ($this->target == 'member') {
+            if ($ssoBrand == 'naver') {
+                // return Redirect::away('https://talk.naver.com/ct/w5u3g9');
+                echo "<script>window.open('https://talk.naver.com/ct/w5u3g9', '_blank', 'width=600,height=600');</script>";
+                return;
+            }elseif($ssoBrand == 'kakao'){
+                echo "<script>window.open('https://pf.kakao.com/_aAAGj/chat', '_blank', 'width=600,height=600');</script>";
+                return;
+                // return Redirect::away('https://pf.kakao.com/_aAAGj/chat');
+            }
+        }
+    }
+
+    public function setConfig($provider, $target)
+    {
+        $config = [
+            'client_id' => $this->oauth2Info['ClientId'],
+            'client_secret' => $this->oauth2Info['ClientSecret'],
+            'redirect' => "/social/$target-$provider/callback"
+        ];
+
+        switch ($provider) {
+            case 'dabory':
+                $driver = Socialite::buildProvider(DaboryProvider::class, [
+                    'client_id' => config('app.api.main.ClientId'),
+                    'client_secret' => config('app.api.main.ClientSecret'),
+                    'redirect' => $config['redirect']
+                ]);
+                break;
+            case 'facebook':
+                $driver = Socialite::buildProvider(FacebookProvider::class, $config);
+                break;
+            case 'kakao':
+                $driver = Socialite::buildProvider(KakaoProvider::class, $config);
+                break;
+            case 'google':
+                $driver = Socialite::buildProvider(GoogleProvider::class, $config);
+                break;
+            case 'naver':
+                $driver = Socialite::buildProvider(NaverProvider::class, $config);
+                break;
+            case 'apple':
+
+                $config['client_secret'] = $this->appleTokenService->generate(
+                    $this->oauth2Info['PrivateKey'],
+                    $this->oauth2Info['ClientId'],
+                    $this->oauth2Info['TeamId'],
+                    $this->oauth2Info['KeyId'],
+                );
+
+                $driver = Socialite::buildProvider(Provider::class, $config);
+                break;
+        }
+        return $driver;
+    }
+}

+ 47 - 2
pro/app/Http/Controllers/Auth/SocialTalkController.php

@@ -2,6 +2,7 @@
 namespace Themes\kbgolf\pro\app\Http\Controllers\Auth;
 
 use App\Http\Controllers\Controller;
+use App\Services\CallApiService;
 use Illuminate\Support\Facades\Redirect;
 use SocialiteProviders\Apple\Provider;
 use Laravel\Socialite\Facades\Socialite;
@@ -9,20 +10,63 @@ use Laravel\Socialite\Two\GoogleProvider;
 use Laravel\Socialite\Two\FacebookProvider;
 use SocialiteProviders\Kakao\KakaoProvider;
 use App\Providers\Socialite\OAuth2\DaboryProvider;
+use App\Services\AppleTokenService;
 use SocialiteProviders\Naver\Provider as NaverProvider;
 use Illuminate\Http\Request;
 
 class SocialTalkController extends Controller
 {
     private $appleTokenService;
+    private $callApiService;
     private $oauth2Info;
     private $target;
 
+    public function __construct(CallApiService $callApiService, AppleTokenService $appleTokenService)
+    {
+        $this->callApiService = $callApiService;
+        $this->appleTokenService = $appleTokenService;
+    }
+
     public function redirectToProvider($provider)
     {
         $this->oauth2Info = request('oauth2Info');
-        // dump($this->oauth2Info);
-        return $this->setConfig($provider, request('target'))->redirect();
+        $brandCode = 'member-'.$provider;
+        $response = $this->callApiService->callApi([
+            'url' => 'setup-page',
+            'data' => [
+                'PageVars' => [
+                    'Query' => "(setup_code = 'sso-client' and brand_code = '{$brandCode}') and is_on_use = '1'",
+                    'Limit' => 100
+                ]
+            ],
+        ]);
+
+        if (!empty($response['Page'])) {
+            $setupJson = $response['Page'][0]['SetupJson'];
+            $setupArray = json_decode($setupJson, true);
+            $redirectUri = route('social.login', ['provider' => $brandCode]);
+            if (json_last_error() === JSON_ERROR_NONE) {
+                $clientId = $setupArray['ClientId'] ?? null;
+                // dd($clientId);
+            }
+        }
+
+        if ($provider == 'naver') {
+            $url = 'https://nid.naver.com/oauth2.0/authorize?' . http_build_query([
+                'response_type' => 'code',
+                'client_id' => $clientId,
+                'redirect_uri' => $redirectUri,
+                'state' => csrf_token(),
+            ]);
+        } elseif ($provider == 'kakao') {
+            $url = 'https://kauth.kakao.com/oauth/authorize?' . http_build_query([
+                'response_type' => 'code',
+                'client_id' => $clientId,
+                'redirect_uri' => $redirectUri,
+                'state' => csrf_token(),
+            ]);
+        }
+        return redirect($url);
     }
 
     public function login($provider)
@@ -37,6 +81,7 @@ class SocialTalkController extends Controller
         }
     }
 
+    //사용안함
     public function setConfig($provider, $target)
     {
         $config = [

+ 7 - 3
pro/app/Http/Controllers/IndexController.php

@@ -23,16 +23,19 @@ class IndexController extends Controller
     {
         $contactSuccess = session()->has('contactSuccess');
         $connectionDevice = session()->get('ConnectionDevice');
+        [$oauth2InfoList, $develLoginInfo] = setupSsoClientOrLoginInfo();
         $response = ProApiCacheFacade::getCachedResponse('list-type1-book', 'list-type1/home-book');
-
         if ($this->callApiService->verifyApiError($response)) {
             notify()->error($response['body'], 'Error', 'bottomRight');
             return redirect()->back();
         }
 
         $widgetTaxo = $response['Book'][0]['Page'];
+        $maMainText = ProApiCacheFacade::filterWidgetTaxo($widgetTaxo, 'ma-main-text', $connectionDevice);
         $maMainSlider = ProApiCacheFacade::filterWidgetTaxo($widgetTaxo, 'ma-main-slider', $connectionDevice);
-        // dd($maMainSlider);
+        $mbSubSlider = ProApiCacheFacade::filterWidgetTaxo($widgetTaxo, 'mb-sub-slider', $connectionDevice);
+        $mbMainText = ProApiCacheFacade::filterWidgetTaxo($widgetTaxo, 'mb-main-text');
+        $cmFooterC = ProApiCacheFacade::filterWidgetTaxo($widgetTaxo, 'cm-footer-c');
 
         date_default_timezone_set('Asia/Seoul');
         $today = date('Ymd');
@@ -229,7 +232,8 @@ class IndexController extends Controller
             return redirect()->back();
         }
 
-        return view('views.index', compact('seoHtml', 'maMainSlider', 'mainSiseList', 'mainYoutubeList', 'youtubeTypes' ,'mainBlogList', 'blogTypes'));
+        return view('views.index', compact('maMainText', 'seoHtml', 'maMainSlider', 'mainSiseList', 'mainYoutubeList',
+                    'youtubeTypes' ,'mainBlogList', 'blogTypes', 'oauth2InfoList', 'develLoginInfo'));
     }
     // 시세 더보기
     public function loadMoreSise(Request $request)

+ 194 - 0
pro/resources/views/layouts/master.blade copy.php

@@ -0,0 +1,194 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <script src="{{ csset('/js/plugins/vue/vue@2.6.11.js') }}"></script>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <meta name="csrf-token" content="{{ csrf_token() }}">
+	<meta property="og:image" content="/public/themes/kbgolf/pro/resources/images/og_img.png">
+    <script src="https://t1.kakaocdn.net/kakao_js_sdk/2.1.0/kakao.min.js" integrity="sha384-dpu02ieKC6NUeKFoGMOKz6102CLEWi9+5RQjWSV0ikYSFFd8M3Wp2reIcquJOemx" crossorigin="anonymous"></script>
+    <script src="https://static.nid.naver.com/js/naveridlogin_js_sdk_2.0.1.js"></script>
+    <script src="{{ csset('/js/iziToast.js') }}"></script>
+    <script src="{{ csset('/js/components/screen-size.js') }}"></script>
+    <?php
+        // used for RESS
+        // if ( !Cookie::has('resolution') ) // doesn't work
+        if ( !isset( $_COOKIE['screenWidth'] ) || !isset( $_COOKIE['screenHeight']) )
+        {
+    ?>
+        <script>get_screen_size()</script>
+    <?php
+        }
+    ?>
+    @stack('meta')
+
+    @php $seoHtml = App\Helpers\Utils::getSeoHtml(); @endphp
+    @empty ($seoHtml)
+        <title>{{ env('APP_NAME') }}</title>
+        <link rel="icon" href="{{ msset(env('FAVICON_PATH')) }}" type="image/x-icon">
+    @else
+        {!! $seoHtml !!}
+    @endempty
+
+    <!-- Google Fonts -->
+    <link href="https://fonts.googleapis.com/css?family=Ubuntu:300,300i,400,400i,500,500i,700,700i&display=swap" rel="stylesheet">
+    <link href="{{ csset('/css/iziToast.css') }}" rel="stylesheet">
+    @php $basePath = '/themes/kbgolf/pro/resources'; @endphp
+
+    @include('views.partial.site.meta', [ 'basePath' => $basePath ])
+    @include('views.partial.site.scripts', [ 'basePath' => $basePath ])
+
+    @stack('css')
+
+</head>
+
+
+<!-- page wrapper -->
+<body class="boxed_wrapper">
+    @inject('callApiService', 'App\Services\CallApiService')
+
+    @php
+        $mainMenuPerm = App\Helpers\Utils::getProMainMenu();
+        $mainMenuPermPage = collect($mainMenuPerm['Page'])->filter(function ($menu) {
+            return $menu['Sort'] === 'primary';
+        })->toArray();
+         $topMenuPermPage = collect($mainMenuPerm['Page'])->filter(function ($menu) {
+            return $menu['Sort'] === 'top';
+        })->toArray();
+        $mainMenuList = App\Helpers\Utils::formatMenuList($mainMenuPermPage, 'MenuCode');
+        $topMenuList = App\Helpers\Utils::formatMenuList($topMenuPermPage, 'MenuCode');
+    @endphp
+
+    @include('layouts.js-lang')
+    @include('vendor.lara-izitoast.toast')
+    <div id="quick-launcher"></div>
+	<div id="quick-launcher">
+		<div class="dabory-quick-B quick-launcher quick_kbgolf">
+            <ul>
+                <li>
+                    <button type="button" class="return-to-bottom">
+                        <span class="ico ico-bottom"></span>
+                    </button>
+                </li>
+                <li>
+					<dl class="quick_tel">
+						<dt>회원권 문의</dt>
+						<dd>
+							본사
+                            <div onclick="document.location.href='tel:02-572-1888'"><strong>02-572-1888</strong></div>
+                            <!-- <strong>02-572-1888</strong> -->
+						</dd>
+						<dd>
+							충청지사
+                            <div onclick="document.location.href='tel:044-863-1889'"><strong>044-863-1889</strong></div>
+                            <!-- <strong>044-863-1889</strong> -->
+						</dd>
+					</dl>
+				</li>
+
+                <li>
+                    <button type="button" id="naver-login-button" class="show-widget-btn" data-widget="naver">
+                    <img src="{{ asset('themes/kbgolf/pro/resources/images/icn_navertalk.png') }}" alt="naver">
+                    <p class="txt">네이버 톡톡</p>
+                </li>
+                <li>
+                    <button type="button" id="kakao-login-button" class="show-widget-btn" data-widget="kakao">
+                    <img src="{{ asset('themes/kbgolf/pro/resources/images/icn_kakaotalk.png') }}" alt="kakao">
+                    <p class="txt">카카오 플러스 친구</p>
+                </li>
+                <li>
+                    <button type="button" class="return-to-top">
+                        <span class="ico ico-top"></span>
+                    </button>
+                </li>
+            </ul>
+        </div>
+	</div>
+
+    <!-- main header -->
+    @include('views.layouts.main-header')
+    <!-- main-header end -->
+
+    <!-- Mobile Menu  -->
+    @include('views.layouts.mobile-menu')
+    <!-- End Mobile Menu -->
+
+    <div id="app">
+        @yield('content')
+    </div>
+
+    <!-- main-footer -->
+    @include('views.layouts.footer')
+    <!-- main-footer end -->
+
+
+    <!-- sidebar cart item -->
+    @include('views.layouts.sidebar')
+    <!-- END sidebar widget item -->
+
+    <!--Scroll to top-->
+    <button class="scroll-top scroll-to-target" data-target="html">
+        <span class="fa fa-arrow-up"></span>
+    </button>
+
+    <div id="element_in_which_to_insert">
+        @yield('modal')
+        @stack('modal')
+    </div>
+
+    @yield('js')
+    @stack('js')
+
+    <script src="{{ csset($basePath . '/js/script.js') }}"></script>
+
+</body><!-- End of .page_wrapper -->
+
+<script>
+    window.env = (@json($_ENV));
+    window.Member = @json(session('member'));
+    window.CodeTitle = @json($codeTitle ?? '');
+</script>
+
+{{--<script src="{{ asset('/dabory/js/widget.js?serverUrl=https://safebanner.daboryhost.com&api23Key=XJAL+1IF4/EgIVcuTvcAOoH9ASKjnQje71boZaGpzwVyVcCoVRsxzyMee5goucaC6cWxzLdEcYfIkfj6bLukvs9+lOeUa3CLqpCbhd7v99Bxm011kxUllDLY8/NrXFVn8aa1e57jygREHo7xF2LWOJ9LHc2idRmQ9rXbI46sgiZBwPmi6E/mACBIjUcKq+uviA==') }}"></script>--}}
+
+<script>
+    Kakao.init(window.env.KAKAO_JAVASCRIPT_KEY);
+    $(document).ready(function () {
+        // $.fn.widget.loadModule(function () {
+        //     $('#quick-launcher').quick()
+        // })
+
+        $('.show-widget-btn').on('click', function() {
+            var widgetType = $(this).data('widget');
+            socialLogin(widgetType);
+        });
+    });
+
+    function socialLogin(widgetType){
+        if(widgetType == 'naver'){
+            var apiUrl = 'https://nid.naver.com/oauth2.0/authorize?response_type=code&client_id=' +
+                            window.env.NAVER_CLIENT_ID + '&redirect_uri=' +
+                            window.env.NAVER_CALLBACK_URL + '&state=' + generateState();
+            var popup = window.open(apiUrl, '_blank', 'width=600,height=600');
+
+        }else if(widgetType == 'kakao'){
+            var apiUrl = 'https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=' +
+                            window.env.KAKAO_JAVASCRIPT_KEY + '&redirect_uri=' +
+                            window.env.KAKAO_CALLBACK_URL + '&state=' + generateState();
+            var popup = window.open(apiUrl, '_blank', 'width=600,height=600');
+        }
+    }
+
+    function generateState() {
+        var mt = new Date().getTime().toString();
+        var rand = Math.random().toString(36).substr(2);
+        var stateValue = mt + rand;
+        var encodedState = encodeURIComponent(stateValue); // URL 인코딩
+        return encodedState;
+    }
+
+</script>
+
+</html>

+ 15 - 44
pro/resources/views/layouts/master.blade.php

@@ -88,16 +88,15 @@
 					</dl>
 				</li>
 
-                <li>
-                    <button type="button" id="naver-login-button" class="show-widget-btn" data-widget="naver">
-                    <img src="{{ asset('themes/kbgolf/pro/resources/images/icn_navertalk.png') }}" alt="naver">
-                    <p class="txt">네이버 톡톡</p>
-                </li>
-                <li>
-                    <button type="button" id="kakao-login-button" class="show-widget-btn" data-widget="kakao">
-                    <img src="{{ asset('themes/kbgolf/pro/resources/images/icn_kakaotalk.png') }}" alt="kakao">
-                    <p class="txt">카카오 플러스 친구</p>
-                </li>
+                @foreach ($oauth2InfoList as $provider => $oauth2)
+                    @if($provider == 'kakao' || $provider == 'naver')
+                        <li>
+                            <button type="button" id="{{ $provider }}-login-button" onclick="openPopup('{{ route('social.redirectToProvider', ['provider' => $provider, 'target' => 'member']) }}')">
+                            <img src="{{ asset('themes/kbgolf/pro/resources/images/' . ($provider == 'naver' ? 'icn_navertalk.png' : 'icn_kakaotalk.png')) }}" alt="{{ $provider }}">
+                            <p class="txt">{{ $provider == 'naver' ? '네이버 톡톡' : '카카오 플러스 친구' }}</p>
+                        </li>
+                    @endif
+                @endforeach
                 <li>
                     <button type="button" class="return-to-top">
                         <span class="ico ico-top"></span>
@@ -154,41 +153,13 @@
 {{--<script src="{{ asset('/dabory/js/widget.js?serverUrl=https://safebanner.daboryhost.com&api23Key=XJAL+1IF4/EgIVcuTvcAOoH9ASKjnQje71boZaGpzwVyVcCoVRsxzyMee5goucaC6cWxzLdEcYfIkfj6bLukvs9+lOeUa3CLqpCbhd7v99Bxm011kxUllDLY8/NrXFVn8aa1e57jygREHo7xF2LWOJ9LHc2idRmQ9rXbI46sgiZBwPmi6E/mACBIjUcKq+uviA==') }}"></script>--}}
 
 <script>
-    Kakao.init(window.env.KAKAO_JAVASCRIPT_KEY);
-    $(document).ready(function () {
-        // $.fn.widget.loadModule(function () {
-        //     $('#quick-launcher').quick()
-        // })
-
-        $('.show-widget-btn').on('click', function() {
-            var widgetType = $(this).data('widget');
-            socialLogin(widgetType);
-        });
-    });
-
-    function socialLogin(widgetType){
-        if(widgetType == 'naver'){
-            var apiUrl = 'https://nid.naver.com/oauth2.0/authorize?response_type=code&client_id=' +
-                            window.env.NAVER_CLIENT_ID + '&redirect_uri=' +
-                            window.env.NAVER_CALLBACK_URL + '&state=' + generateState();
-            var popup = window.open(apiUrl, '_blank', 'width=600,height=600');
-
-        }else if(widgetType == 'kakao'){
-            var apiUrl = 'https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=' +
-                            window.env.KAKAO_JAVASCRIPT_KEY + '&redirect_uri=' +
-                            window.env.KAKAO_CALLBACK_URL + '&state=' + generateState();
-            var popup = window.open(apiUrl, '_blank', 'width=600,height=600');
-        }
-    }
-
-    function generateState() {
-        var mt = new Date().getTime().toString();
-        var rand = Math.random().toString(36).substr(2);
-        var stateValue = mt + rand;
-        var encodedState = encodeURIComponent(stateValue); // URL 인코딩
-        return encodedState;
+    function openPopup(url) {
+        const width = 600;
+        const height = 600;
+        const left = (window.innerWidth / 2) - (width / 2);
+        const top = (window.innerHeight / 2) - (height / 2);
+        window.open(url, 'oauthPopup', `width=${width},height=${height},top=${top},left=${left}`);
     }
-
 </script>
 
 </html>