Force refresh tokens
curl --request POST \
--url https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh \
--header 'Authorization: Bearer <token>' \
--header 'x-cal-secret-key: <x-cal-secret-key>'import requests
url = "https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh"
headers = {
"x-cal-secret-key": "<x-cal-secret-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-cal-secret-key': '<x-cal-secret-key>', Authorization: 'Bearer <token>'}
};
fetch('https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-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://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-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: Bearer <token>",
"x-cal-secret-key: <x-cal-secret-key>"
],
]);
$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://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-cal-secret-key", "<x-cal-secret-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh")
.header("x-cal-secret-key", "<x-cal-secret-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cal-secret-key"] = '<x-cal-secret-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"accessTokenExpiresAt": 123,
"refreshTokenExpiresAt": 123
}
}Platform / Managed Users
Force refresh tokens
These endpoints are deprecated and will be removed in the future.
calAccessToken and calRefreshToken fields.
Response also contains accessTokenExpiresAt and refreshTokenExpiresAt fields, but if you decode the jwt token the payload will contain clientId (OAuth client ID), ownerId (user to whom token belongs ID), iat (issued at time) and expiresAt (when does the token expire) fields.POST
/
v2
/
oauth-clients
/
{clientId}
/
users
/
{userId}
/
force-refresh
Force refresh tokens
curl --request POST \
--url https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh \
--header 'Authorization: Bearer <token>' \
--header 'x-cal-secret-key: <x-cal-secret-key>'import requests
url = "https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh"
headers = {
"x-cal-secret-key": "<x-cal-secret-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-cal-secret-key': '<x-cal-secret-key>', Authorization: 'Bearer <token>'}
};
fetch('https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-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://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-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: Bearer <token>",
"x-cal-secret-key: <x-cal-secret-key>"
],
]);
$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://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-cal-secret-key", "<x-cal-secret-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh")
.header("x-cal-secret-key", "<x-cal-secret-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.com/v2/oauth-clients/{clientId}/users/{userId}/force-refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-cal-secret-key"] = '<x-cal-secret-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"accessTokenExpiresAt": 123,
"refreshTokenExpiresAt": 123
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
OAuth client secret key
Was this page helpful?