User Auth
Refresh Access Token
Exchange a refresh token for a new access token
POST
/
v0
/
auth
/
refresh
Refresh access token
curl --request POST \
--url https://1click.chaindefuser.com/v0/auth/refresh \
--header 'Content-Type: application/json' \
--data '
{
"refreshToken": "<string>"
}
'import requests
url = "https://1click.chaindefuser.com/v0/auth/refresh"
payload = { "refreshToken": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({refreshToken: '<string>'})
};
fetch('https://1click.chaindefuser.com/v0/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://1click.chaindefuser.com/v0/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_POSTFIELDS => json_encode([
'refreshToken' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://1click.chaindefuser.com/v0/auth/refresh"
payload := strings.NewReader("{\n \"refreshToken\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://1click.chaindefuser.com/v0/auth/refresh")
.header("Content-Type", "application/json")
.body("{\n \"refreshToken\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://1click.chaindefuser.com/v0/auth/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"refreshToken\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"expiresIn": 123
}Once the
accessToken from Authenticate User with Signed Data expires, exchange refreshToken for a new accessToken without re-signing.
Example request
curl -X POST https://1click.chaindefuser.com/v0/auth/refresh \
-H "Content-Type: application/json" \
-d '{ "refreshToken": "YOUR_REFRESH_TOKEN" }'
const response = await fetch('https://1click.chaindefuser.com/v0/auth/refresh', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ refreshToken: 'YOUR_REFRESH_TOKEN' })
});
const auth = await response.json();
Example response
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600
}
The response only contains a new
accessToken, refreshToken itself does not rotate. Keep using the same refreshToken until it expires (refreshExpiresIn from the original authenticate call).Was this page helpful?
Previous
Get user token balancesReturns token balances for the authenticated user from private balance sources
Next
⌘I
Refresh access token
curl --request POST \
--url https://1click.chaindefuser.com/v0/auth/refresh \
--header 'Content-Type: application/json' \
--data '
{
"refreshToken": "<string>"
}
'import requests
url = "https://1click.chaindefuser.com/v0/auth/refresh"
payload = { "refreshToken": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({refreshToken: '<string>'})
};
fetch('https://1click.chaindefuser.com/v0/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://1click.chaindefuser.com/v0/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_POSTFIELDS => json_encode([
'refreshToken' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://1click.chaindefuser.com/v0/auth/refresh"
payload := strings.NewReader("{\n \"refreshToken\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://1click.chaindefuser.com/v0/auth/refresh")
.header("Content-Type", "application/json")
.body("{\n \"refreshToken\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://1click.chaindefuser.com/v0/auth/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"refreshToken\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accessToken": "<string>",
"expiresIn": 123
}