인증
인증 토큰 발급
Kakao 로그인 후 발급된 코드로 로그인할 수 있는 액세스 토큰 및 리프레시 토큰을 발급합니다.
액세스 토큰은 메모리에 저장 후 Authorization 헤더에 담아 전송해야 합니다.
리프레시 토큰은 쿠키나 Keychain, Keystore에 저장하고 /api/v1/auth/refresh로 요청할 때만 전송하도록 해야 합니다.
액세스 토큰은 10분(600초), 리프레시 토큰은 1년(31536000초) 간 유효합니다.
POST
/
api
/
v1
/
auth
/
exchange
인증 토큰 발급
curl --request POST \
--url https://k-polaris.life/api/v1/auth/exchange \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"code": "<string>",
"targetId": "<string>",
"codeVerifier": "<string>"
}
'import requests
url = "https://k-polaris.life/api/v1/auth/exchange"
payload = {
"code": "<string>",
"targetId": "<string>",
"codeVerifier": "<string>"
}
headers = {"Content-Type": "application/json;charset=UTF-8"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({code: '<string>', targetId: '<string>', codeVerifier: '<string>'})
};
fetch('https://k-polaris.life/api/v1/auth/exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://k-polaris.life/api/v1/auth/exchange",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'targetId' => '<string>',
'codeVerifier' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json;charset=UTF-8"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://k-polaris.life/api/v1/auth/exchange"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"targetId\": \"<string>\",\n \"codeVerifier\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://k-polaris.life/api/v1/auth/exchange")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"code\": \"<string>\",\n \"targetId\": \"<string>\",\n \"codeVerifier\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://k-polaris.life/api/v1/auth/exchange")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"code\": \"<string>\",\n \"targetId\": \"<string>\",\n \"codeVerifier\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"refreshToken": "<string>",
"expiresIn": 123,
"userId": 123
}⌘I
인증 토큰 발급
curl --request POST \
--url https://k-polaris.life/api/v1/auth/exchange \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"code": "<string>",
"targetId": "<string>",
"codeVerifier": "<string>"
}
'import requests
url = "https://k-polaris.life/api/v1/auth/exchange"
payload = {
"code": "<string>",
"targetId": "<string>",
"codeVerifier": "<string>"
}
headers = {"Content-Type": "application/json;charset=UTF-8"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({code: '<string>', targetId: '<string>', codeVerifier: '<string>'})
};
fetch('https://k-polaris.life/api/v1/auth/exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://k-polaris.life/api/v1/auth/exchange",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>',
'targetId' => '<string>',
'codeVerifier' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json;charset=UTF-8"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://k-polaris.life/api/v1/auth/exchange"
payload := strings.NewReader("{\n \"code\": \"<string>\",\n \"targetId\": \"<string>\",\n \"codeVerifier\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://k-polaris.life/api/v1/auth/exchange")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"code\": \"<string>\",\n \"targetId\": \"<string>\",\n \"codeVerifier\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://k-polaris.life/api/v1/auth/exchange")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"code\": \"<string>\",\n \"targetId\": \"<string>\",\n \"codeVerifier\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"refreshToken": "<string>",
"expiresIn": 123,
"userId": 123
}