const kakaoHeader = {
'Authorization': 'ddb282e9e9a5e2bb7d96c93b41bf21a4',
'Content-type': 'application/x-www-form-urlencoded;charset=utf-8',
};
const getKakaoToken = async (code) => {
console.log(‘loginWithKakao’);
try {
const data = {
grant_type: ‘authorization_code’,
client_id: ‘7f388f87a53c908f562ab8cf34456a7e’,
redirect_uri: ‘http://localhost:8080/home’,
code: code,
};
const queryString = Object.keys(data)
.map(k => encodeURIComponent(k) + ‘=’ + encodeURIComponent(data[k]))
.join(’&’);
console.log(queryString)
console.log(('https://kauth.kakao.com/oauth/token', queryString, { headers: kakaoHeader }))
const result = await axios.post(`https://kauth.kakao.com/oauth/token`, queryString, { headers: kakaoHeader });
console.log('카카오 토큰', queryString);
console.log(result)
return result;
} catch (e) {
return e;
}
};
Vue.js 입니다.
client_id, redirect_uri, code 재확인도 해봤는데…
왜 POST https://kauth.kakao.com/oauth/token 400 (Bad Request) 가 뜰까요 ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ
혹시 몰라 전체 코드 올린 깃 레포지 주소도 올립니다 ㅠㅠ