토큰 발급 / 갱신
curl --request POST \
--url https://developers.rocketpunch.com/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=authorization_code \
--data 'code=<string>' \
--data redirect_uri=https://builder.example.com/callback \
--data 'code_verifier=<string>' \
--data 'client_id=<string>' \
--data 'client_secret=<string>'import requests
url = "https://developers.rocketpunch.com/oauth/token"
payload = {
"grant_type": "authorization_code",
"code": "<string>",
"redirect_uri": "https://builder.example.com/callback",
"code_verifier": "<string>",
"client_id": "<string>",
"client_secret": "<string>"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'authorization_code',
code: '<string>',
redirect_uri: 'https://builder.example.com/callback',
code_verifier: '<string>',
client_id: '<string>',
client_secret: '<string>'
})
};
fetch('https://developers.rocketpunch.com/oauth/token', 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://developers.rocketpunch.com/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=authorization_code&code=%3Cstring%3E&redirect_uri=https%3A%2F%2Fbuilder.example.com%2Fcallback&code_verifier=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://developers.rocketpunch.com/oauth/token"
payload := strings.NewReader("grant_type=authorization_code&code=%3Cstring%3E&redirect_uri=https%3A%2F%2Fbuilder.example.com%2Fcallback&code_verifier=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://developers.rocketpunch.com/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=authorization_code&code=%3Cstring%3E&redirect_uri=https%3A%2F%2Fbuilder.example.com%2Fcallback&code_verifier=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://developers.rocketpunch.com/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=authorization_code&code=%3Cstring%3E&redirect_uri=https%3A%2F%2Fbuilder.example.com%2Fcallback&code_verifier=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJSUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "rt_a1b2c3d4...",
"scope": "profile:read"
}{
"error": "invalid_grant",
"error_description": "Authorization code expired or already used."
}{
"error": "invalid_grant",
"error_description": "Authorization code expired or already used."
}{
"code": "C0005",
"message": "요청 값이 올바르지 않습니다.",
"timestamp": "2026-05-20T09:00:00",
"details": "startDate"
}{
"error": "invalid_grant",
"error_description": "Authorization code expired or already used."
}OAuth Token
토큰 발급 / 갱신
사용자 컨텍스트 access token 을 발급·갱신한다. grant_type=authorization_code 면 /oauth/authorize 에서 받은 code + PKCE code_verifier 로 최초 발급하고, grant_type=refresh_token 이면 refresh_token 으로 재발급한다. 응답 access_token 은 Authorization: Bearer <jwt> 형식으로 사용자 컨텍스트 /v1/** 및 /oauth/userinfo 호출에 사용한다. 클라이언트 인증은 HTTP Basic 또는 본문의 client_id/client_secret.
POST
/
oauth
/
token
토큰 발급 / 갱신
curl --request POST \
--url https://developers.rocketpunch.com/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=authorization_code \
--data 'code=<string>' \
--data redirect_uri=https://builder.example.com/callback \
--data 'code_verifier=<string>' \
--data 'client_id=<string>' \
--data 'client_secret=<string>'import requests
url = "https://developers.rocketpunch.com/oauth/token"
payload = {
"grant_type": "authorization_code",
"code": "<string>",
"redirect_uri": "https://builder.example.com/callback",
"code_verifier": "<string>",
"client_id": "<string>",
"client_secret": "<string>"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'authorization_code',
code: '<string>',
redirect_uri: 'https://builder.example.com/callback',
code_verifier: '<string>',
client_id: '<string>',
client_secret: '<string>'
})
};
fetch('https://developers.rocketpunch.com/oauth/token', 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://developers.rocketpunch.com/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=authorization_code&code=%3Cstring%3E&redirect_uri=https%3A%2F%2Fbuilder.example.com%2Fcallback&code_verifier=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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://developers.rocketpunch.com/oauth/token"
payload := strings.NewReader("grant_type=authorization_code&code=%3Cstring%3E&redirect_uri=https%3A%2F%2Fbuilder.example.com%2Fcallback&code_verifier=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://developers.rocketpunch.com/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=authorization_code&code=%3Cstring%3E&redirect_uri=https%3A%2F%2Fbuilder.example.com%2Fcallback&code_verifier=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E")
.asString();require 'uri'
require 'net/http'
url = URI("https://developers.rocketpunch.com/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=authorization_code&code=%3Cstring%3E&redirect_uri=https%3A%2F%2Fbuilder.example.com%2Fcallback&code_verifier=%3Cstring%3E&client_id=%3Cstring%3E&client_secret=%3Cstring%3E"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJSUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "rt_a1b2c3d4...",
"scope": "profile:read"
}{
"error": "invalid_grant",
"error_description": "Authorization code expired or already used."
}{
"error": "invalid_grant",
"error_description": "Authorization code expired or already used."
}{
"code": "C0005",
"message": "요청 값이 올바르지 않습니다.",
"timestamp": "2026-05-20T09:00:00",
"details": "startDate"
}{
"error": "invalid_grant",
"error_description": "Authorization code expired or already used."
}헤더
본문
application/x-www-form-urlencoded
- Option 1
- Option 2
grant_type=authorization_code 토큰 교환 요청
이 페이지가 도움이 되었나요?