try {
const tokenUrl = ‘https://kauth.kakao.com/oauth/token’;
const params = new URLSearchParams();
params.append(‘grant_type’, ‘authorization_code’);
params.append(‘client_id’, client_id);
params.append(‘redirect_uri’, redirect_uri);
params.append(‘code’, code);
const kakaoHeader = {
'Content-type':'application/x-www-form-urlencoded;'
};
const response = await axios.post(tokenUrl, params, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
console.log('결과응답:', response.data);
const accessToken = response.data.access_token;
console.log('액세스 토큰:', accessToken);
// 사용자 정보 요청
//getUserInfo(accessToken);
} catch (error) {
console.error('액세스 토큰 요청 오류:', error.response ? error.response.data : error.message);
}
{error: ‘invalid_grant’, error_description: ‘Redirect URI mismatch.’, error_code: ‘KOE303’}
{error: ‘invalid_grant’, error_description: ‘Redirect URI mismatch.’, error_code: ‘KOE303’}{error: ‘invalid_grant’, error_description: ‘Redirect URI mismatch.’, error_code: ‘KOE303’}
등록된 Redirect URI 는 확인 하였습니다.
http://116.33.116.110:28080/portal/gc/ml/redirectKakao.do
http://116.33.116.110:28080/portal/gc/ml/kakaoUserInfo.do