인증
인증 토큰 재발급
리프레시 토큰을 사용해 액세스 토큰을 재발급하고 기존 리프레시 토큰을 무효화합니다.
POST
/
api
/
v1
/
auth
/
refresh
인증 토큰 재발급
curl --request POST \
--url https://k-polaris.life/api/v1/auth/refresh \
--header 'Authorization: <authorization>'import requests
url = "https://k-polaris.life/api/v1/auth/refresh"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://k-polaris.life/api/v1/auth/refresh', 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/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://k-polaris.life/api/v1/auth/refresh"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
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/refresh")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://k-polaris.life/api/v1/auth/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"refreshToken": "<string>",
"expiresIn": 123,
"userId": 123
}Previous
인증 토큰 발급
<p>Kakao 로그인 후 발급된 코드로 로그인할 수 있는 액세스 토큰 및 리프레시 토큰을 발급합니다.</p>
<p>액세스 토큰은 메모리에 저장 후 Authorization 헤더에 담아 전송해야 합니다.</p>
<p>리프레시 토큰은 쿠키나 Keychain, Keystore에 저장하고 <code>/api/v1/auth/refresh</code>로 요청할 때만 전송하도록 해야 합니다.</p>
<p>액세스 토큰은 10분(600초), 리프레시 토큰은 1년(31536000초) 간 유효합니다.</p>
Next
⌘I
인증 토큰 재발급
curl --request POST \
--url https://k-polaris.life/api/v1/auth/refresh \
--header 'Authorization: <authorization>'import requests
url = "https://k-polaris.life/api/v1/auth/refresh"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://k-polaris.life/api/v1/auth/refresh', 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/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://k-polaris.life/api/v1/auth/refresh"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
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/refresh")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://k-polaris.life/api/v1/auth/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"refreshToken": "<string>",
"expiresIn": 123,
"userId": 123
}