KakaoLogin.js
841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { makeStyles } from '@material-ui/core/styles';
import TextField from '@material-ui/core/TextField';
import React from 'react';
import path from 'path';
require("dotenv").config({
path : path.join(__dirname,'/jaksimsamil-server/.env')
});
console.log(process.env.KAKAO_JS_KEY);
const useStyles = makeStyles((theme) => ({
root: {
'& > *': {
margin: theme.spacing(1),
},
},
button: {
margin: theme.spacing(1),
},
}));
const KakaoLoginBtn = () => {
const classes = useStyles();
const kakaoLogin = function() {
window.Kakao.Auth.login({
success:function(auth) {
console.log(auth);
},
fail:function(err) {
console.log(err);
}
})
}
return (
<div>
<button onClick={kakaoLogin}>KakaoLogin</button>
</div>
);
};
export default KakaoLoginBtn