Skip to content

Commit

Permalink
refactor: client_id 설정 시 vite의 환경 변수를 사용하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Puterism committed Feb 3, 2024
1 parent 90c1bf9 commit e21de1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/api/src/mutations/useKakaoToken.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useMutation } from '@tanstack/react-query';
import ky from 'ky';
import { KAKAO_REST_API_KEY } from '../secrets';

interface PostKakaoTokenRequest {
code: string;
Expand All @@ -20,7 +19,7 @@ const postKakaoToken = ({ code }: PostKakaoTokenRequest) => {
const body = new URLSearchParams();

body.set('grant_type', 'authorization_code');
body.set('client_id', KAKAO_REST_API_KEY);
body.set('client_id', import.meta.env.VITE_KAKAO_REST_API_KEY ?? '');
body.set('redirect_uri', `${window.location.origin}/oauth/kakao`);
body.set('code', code);

Expand Down
9 changes: 9 additions & 0 deletions packages/api/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_KAKAO_REST_API_KEY: string;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}

0 comments on commit e21de1c

Please sign in to comment.