curl -X POST "https://api.tktchurch.com/v1/auth/devices/revoke-all" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
const revokeAllDevices = async (accessToken) => {
const response = await fetch(
'https://api.tktchurch.com/v1/auth/devices/revoke-all',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.reason);
}
return response.status === 204;
};
// Usage
try {
await revokeAllDevices('eyJhbGciOiJIUzI1NiIs...');
console.log('All other devices revoked successfully');
} catch (error) {
console.error('Failed to revoke devices:', error.message);
}
func revokeAllDevices(accessToken: String) async throws {
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/devices/revoke-all")!)
urlRequest.httpMethod = "POST"
urlRequest.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
let (_, response) = try await URLSession.shared.data(for: urlRequest)
guard let httpResponse = response as? HTTPURLResponse else {
throw URLError(.badServerResponse)
}
if httpResponse.statusCode != 204 {
throw URLError(.badServerResponse)
}
}
// Usage
do {
try await revokeAllDevices(accessToken: "eyJhbGciOiJIUzI1NiIs...")
print("All other devices revoked successfully")
} catch {
print("Failed to revoke devices: \(error.localizedDescription)")
}
class DeviceService(private val client: OkHttpClient) {
suspend fun revokeAllDevices(accessToken: String) {
val request = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/devices/revoke-all")
.post(RequestBody.create(null, ByteArray(0)))
.header("Authorization", "Bearer $accessToken")
.build()
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) {
val error = response.body?.string()?.fromJson<ErrorResponse>()
throw Exception(error?.reason ?: "Failed to revoke devices")
}
}
}
}
// Usage
try {
deviceService.revokeAllDevices("eyJhbGciOiJIUzI1NiIs...")
println("All other devices revoked successfully")
} catch (e: Exception) {
println("Failed to revoke devices: ${e.message}")
}
import axios from 'axios';
const revokeAllDevices = async (accessToken: string): Promise<void> => {
try {
await axios.post(
'https://api.tktchurch.com/v1/auth/devices/revoke-all',
null,
{
headers: {
'Authorization': `Bearer ${accessToken}`
},
}
);
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Failed to revoke devices');
}
throw error;
}
};
// Usage
try {
await revokeAllDevices('eyJhbGciOiJIUzI1NiIs...');
console.log('All other devices revoked successfully');
} catch (error) {
console.error('Failed to revoke devices:', error.message);
}
{
"error": {
"status": 401,
"reason": "Invalid or expired access token"
}
}
{
"error": {
"status": 500,
"reason": "Invalid user ID in token"
}
}
Devices
Revoke All Devices
Revoke access for all devices except the current one, effectively logging out all other sessions
POST
/
auth
/
devices
/
revoke-all
curl -X POST "https://api.tktchurch.com/v1/auth/devices/revoke-all" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
const revokeAllDevices = async (accessToken) => {
const response = await fetch(
'https://api.tktchurch.com/v1/auth/devices/revoke-all',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.reason);
}
return response.status === 204;
};
// Usage
try {
await revokeAllDevices('eyJhbGciOiJIUzI1NiIs...');
console.log('All other devices revoked successfully');
} catch (error) {
console.error('Failed to revoke devices:', error.message);
}
func revokeAllDevices(accessToken: String) async throws {
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/devices/revoke-all")!)
urlRequest.httpMethod = "POST"
urlRequest.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
let (_, response) = try await URLSession.shared.data(for: urlRequest)
guard let httpResponse = response as? HTTPURLResponse else {
throw URLError(.badServerResponse)
}
if httpResponse.statusCode != 204 {
throw URLError(.badServerResponse)
}
}
// Usage
do {
try await revokeAllDevices(accessToken: "eyJhbGciOiJIUzI1NiIs...")
print("All other devices revoked successfully")
} catch {
print("Failed to revoke devices: \(error.localizedDescription)")
}
class DeviceService(private val client: OkHttpClient) {
suspend fun revokeAllDevices(accessToken: String) {
val request = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/devices/revoke-all")
.post(RequestBody.create(null, ByteArray(0)))
.header("Authorization", "Bearer $accessToken")
.build()
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) {
val error = response.body?.string()?.fromJson<ErrorResponse>()
throw Exception(error?.reason ?: "Failed to revoke devices")
}
}
}
}
// Usage
try {
deviceService.revokeAllDevices("eyJhbGciOiJIUzI1NiIs...")
println("All other devices revoked successfully")
} catch (e: Exception) {
println("Failed to revoke devices: ${e.message}")
}
import axios from 'axios';
const revokeAllDevices = async (accessToken: string): Promise<void> => {
try {
await axios.post(
'https://api.tktchurch.com/v1/auth/devices/revoke-all',
null,
{
headers: {
'Authorization': `Bearer ${accessToken}`
},
}
);
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Failed to revoke devices');
}
throw error;
}
};
// Usage
try {
await revokeAllDevices('eyJhbGciOiJIUzI1NiIs...');
console.log('All other devices revoked successfully');
} catch (error) {
console.error('Failed to revoke devices:', error.message);
}
{
"error": {
"status": 401,
"reason": "Invalid or expired access token"
}
}
{
"error": {
"status": 500,
"reason": "Invalid user ID in token"
}
}
This endpoint requires authentication. Include the JWT access token in the Authorization header.
Response
A successful request returns HTTP 204 No Content status. The following actions are performed:- The current device’s token is preserved
- All other refresh tokens are blacklisted
- All associated access tokens are blacklisted
- The blacklisted tokens are removed from the database
Error Responses
object
Common error cases:
- 401 Unauthorized: Missing or invalid access token
- 500 Internal Server Error: Invalid user ID in token
curl -X POST "https://api.tktchurch.com/v1/auth/devices/revoke-all" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
const revokeAllDevices = async (accessToken) => {
const response = await fetch(
'https://api.tktchurch.com/v1/auth/devices/revoke-all',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.reason);
}
return response.status === 204;
};
// Usage
try {
await revokeAllDevices('eyJhbGciOiJIUzI1NiIs...');
console.log('All other devices revoked successfully');
} catch (error) {
console.error('Failed to revoke devices:', error.message);
}
func revokeAllDevices(accessToken: String) async throws {
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/devices/revoke-all")!)
urlRequest.httpMethod = "POST"
urlRequest.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
let (_, response) = try await URLSession.shared.data(for: urlRequest)
guard let httpResponse = response as? HTTPURLResponse else {
throw URLError(.badServerResponse)
}
if httpResponse.statusCode != 204 {
throw URLError(.badServerResponse)
}
}
// Usage
do {
try await revokeAllDevices(accessToken: "eyJhbGciOiJIUzI1NiIs...")
print("All other devices revoked successfully")
} catch {
print("Failed to revoke devices: \(error.localizedDescription)")
}
class DeviceService(private val client: OkHttpClient) {
suspend fun revokeAllDevices(accessToken: String) {
val request = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/devices/revoke-all")
.post(RequestBody.create(null, ByteArray(0)))
.header("Authorization", "Bearer $accessToken")
.build()
client.newCall(request).execute().use { response ->
if (!response.isSuccessful) {
val error = response.body?.string()?.fromJson<ErrorResponse>()
throw Exception(error?.reason ?: "Failed to revoke devices")
}
}
}
}
// Usage
try {
deviceService.revokeAllDevices("eyJhbGciOiJIUzI1NiIs...")
println("All other devices revoked successfully")
} catch (e: Exception) {
println("Failed to revoke devices: ${e.message}")
}
import axios from 'axios';
const revokeAllDevices = async (accessToken: string): Promise<void> => {
try {
await axios.post(
'https://api.tktchurch.com/v1/auth/devices/revoke-all',
null,
{
headers: {
'Authorization': `Bearer ${accessToken}`
},
}
);
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Failed to revoke devices');
}
throw error;
}
};
// Usage
try {
await revokeAllDevices('eyJhbGciOiJIUzI1NiIs...');
console.log('All other devices revoked successfully');
} catch (error) {
console.error('Failed to revoke devices:', error.message);
}
{
"error": {
"status": 401,
"reason": "Invalid or expired access token"
}
}
{
"error": {
"status": 500,
"reason": "Invalid user ID in token"
}
}
