게시글
질문&답변
2019.11.19
request 작성
if (req.user.dataValues.provider == 'kakao'){ axios.post('http://kapi.kakao.com/v1/user/unlink', {}, { headers: { 'Authorization': `Bearer ${req.user.dataValues.token}` }}) .then((response) => { console.log("!!!!!!!!!!!!!!!!!!!!!!!!AXIOS logout OK"); req.logout(); req.session.destroy(); res.redirect('/'); }) .catch((error) => { console.error(error); return next(error); }); } else{ console.log("logout OK"); req.logout(); req.session.destroy(); res.redirect('/'); } }) Error: Request failed with status code 404 at createError (D:\Study\Server\nodejs\nodejsLib\login\node_modules\axios\lib\core\createError.js:16:15) at settle (D:\Study\Server\nodejs\nodejsLib\login\node_modules\axios\lib\core\settle.js:17:12) at IncomingMessage.handleStreamEnd (D:\Study\Server\nodejs\nodejsLib\login\node_modules\axios\lib\adapters\http.js:237:11) at IncomingMessage.emit (events.js:215:7) at endReadableNT (_stream_readable.js:1198:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) { config: { url: 'http://kapi.kakao.com/v1/user/logout', method: 'post', data: '{}', headers: { Accept: 'application/json, text/plain, */*', 'Content-Type': 'application/json;charset=utf-8', Authorization: 'Bearer wIJoCW23LVAvEfjZH7mjsUt32jV8XjI7QQrKXgo9dRoAAAFug9Tyiw', 'User-Agent': 'axios/0.19.0', 'Content-Length': 2 }, transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus] }, request: ClientRequest { _events: [Object: null prototype] { socket: [Function (anonymous)], abort: [Function (anonymous)], aborted: [Function (anonymous)], error: [Function (anonymous)], timeout: [Function (anonymous)], prefinish: [Function: requestOnPrefinish] }, _eventsCount: 6, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: Socket { connecting: false, _hadError: false, _parent: null, _host: 'kapi.kakao.com', _readableState: [ReadableState], readable: true, _events: [Object: null prototype], _eventsCount: 6, _maxListeners: undefined, _writableState: [WritableState], writable: false, allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: [Circular *1], [Symbol(asyncId)]: 283, [Symbol(kHandle)]: [TCP], [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0 }, _header: 'POST /v1/user/logout HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'Content-Type: application/json;charset=utf-8\r\n' + 'Authorization: Bearer wIJoCW23LVAvEfjZH7mjsUt32jV8XjI7QQrKXgo9dRoAAAFug9Tyiw\r\n' + 'User-Agent: axios/0.19.0\r\n' + 'Content-Length: 2\r\n' + 'Host: kapi.kakao.com\r\n' + 'Connection: close\r\n' + '\r\n', _onPendingData: [Function: noopPendingOutput], agent: Agent { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, defaultPort: 80, protocol: 'http:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256 }, socketPath: undefined, method: 'POST', path: '/v1/user/logout', _ended: true, res: IncomingMessage { _readableState: [ReadableState], readable: false, _events: [Object: null prototype], _eventsCount: 3, _maxListeners: undefined, socket: [Socket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: [Object], rawHeaders: [Array], trailers: {}, rawTrailers: [], aborted: false, upgrade: false, url: '', method: null, statusCode: 404, statusMessage: 'Not Found', client: [Socket], _consuming: false, _dumped: false, req: [Circular *1], responseUrl: 'http://kapi.kakao.com/v1/user/logout', redirects: [] }, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, _redirectable: Writable { _writableState: [WritableState], writable: true, _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, _options: [Object], _redirectCount: 0, _redirects: [], _requestBodyLength: 2, _requestBodyBuffers: [], _onNativeResponse: [Function (anonymous)], _currentRequest: [Circular *1], _currentUrl: 'http://kapi.kakao.com/v1/user/logout' }, [Symbol(kNeedDrain)]: false, [Symbol(isCorked)]: false, [Symbol(kOutHeaders)]: [Object: null prototype] { accept: [Array], 'content-type': [Array], authorization: [Array], 'user-agent': [Array], 'content-length': [Array], host: [Array] } }, response: { status: 404, statusText: 'Not Found', headers: { date: 'Tue, 19 Nov 2019 13:23:22 GMT', server: 'Apache', 'content-length': '3', connection: 'close', 'content-type': 'text/html; charset=iso-8859-1' }, config: { url: 'http://kapi.kakao.com/v1/user/logout', method: 'post', data: '{}', headers: [Object], transformRequest: [Array], transformResponse: [Array], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus] }, request: ClientRequest { _events: [Object: null prototype], _eventsCount: 6, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: true, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: null, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [Socket], _header: 'POST /v1/user/logout HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'Content-Type: application/json;charset=utf-8\r\n' + 'Authorization: Bearer wIJoCW23LVAvEfjZH7mjsUt32jV8XjI7QQrKXgo9dRoAAAFug9Tyiw\r\n' + 'User-Agent: axios/0.19.0\r\n' + 'Content-Length: 2\r\n' + 'Host: kapi.kakao.com\r\n' + 'Connection: close\r\n' + '\r\n', _onPendingData: [Function: noopPendingOutput], agent: [Agent], socketPath: undefined, method: 'POST', path: '/v1/user/logout', _ended: true, res: [IncomingMessage], aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, _redirectable: [Writable], [Symbol(kNeedDrain)]: false, [Symbol(isCorked)]: false, [Symbol(kOutHeaders)]: [Object: null prototype] }, data: 404 }, isAxiosError: true, toJSON: [Function (anonymous)] } 이런 에러가 발생합니다...
- 0
- 3
- 313
질문&답변
2019.11.18
카카오톡 로그아웃 안됨.
https://devtalk.kakao.com/t/topic/45287Kakao.Auth.logout()은 토큰을 만료시키는 역할을 하는 것이고 카카오 계정의 로그아웃과는 다르다고 합니다. 그럼 카카오 로그인이 된 경우만 로그아웃을 시키는 방법을 다르게 코딩해야 하는 것인지 다른 SNS들도 비슷한 방식인 것인지 여쭙고 싶습니다.
- 0
- 6
- 2.3K
질문&답변
2019.11.18
카카오톡 로그아웃 안됨.
카카오 로그인 창이 뜨기도 전에 로그인이 됩니다. 데브 카카오에 로그인 이후 로그아웃 하면 노드버드도 같이 로그아웃 되는(?) 현상이 있어 일단 로그아웃은 시켰습니다. https://developers.kakao.com/docs/restapi/user-management#로그아웃 이것을 활용하면 될 것 같습니다만 실력이 부족하여 공부가 더 필요할 것 같습니다 ㅎㅎ.. 감사합니다!
- 0
- 6
- 2.3K
질문&답변
2019.11.18
카카오톡 로그아웃 안됨.
카카오쪽으로 로그아웃을 보내야 하는 것인가요?
- 0
- 6
- 2.3K
질문&답변
2019.11.18
카카오톡 로그아웃 안됨.
크롬 개발자 도구로 직접 지워봐도 안되네요 ㅠ
- 0
- 6
- 2.3K
질문&답변
2019.11.05
같은 방식으로 코딩을 했는데요 이런 에러가 뜨네요.
앗... 죄송합니다 ㅠ 답변 감사합니다!
- 0
- 2
- 629
질문&답변
2019.06.04
비구조화 할당 강의에서 질문드립니다.
(사진) 그렇군요! 다시 해보니 이해되었습니다. 감사합니다!
- 0
- 2
- 155