curl -X GET "https://api.tktchurch.com/v1/auth/users/123e4567-e89b-12d3-a456-426614174000" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
const getUser = async (accessToken, userId) => {
const response = await fetch(
`https://api.tktchurch.com/v1/auth/users/${userId}`,
{
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.reason);
}
return response.json();
};
// Usage
try {
const user = await getUser(
'eyJhbGciOiJIUzI1NiIs...', // access token
'123e4567-e89b-12d3-a456-426614174000' // user ID
);
console.log('User:', user);
} catch (error) {
console.error('Failed to get user:', error.message);
}
func getUser(accessToken: String, userId: UUID) async throws -> User {
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/users/\(userId)")!)
urlRequest.httpMethod = "GET"
urlRequest.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
let (data, response) = try await URLSession.shared.data(for: urlRequest)
guard let httpResponse = response as? HTTPURLResponse else {
throw URLError(.badServerResponse)
}
if httpResponse.statusCode != 200 {
let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
throw error
}
return try JSONDecoder().decode(User.self, from: data)
}
// Usage
do {
let user = try await getUser(
accessToken: "eyJhbGciOiJIUzI1NiIs...",
userId: UUID(uuidString: "123e4567-e89b-12d3-a456-426614174000")!
)
print("User:", user)
} catch {
print("Failed to get user: \(error.localizedDescription)")
}
class UserService(private val client: OkHttpClient) {
suspend fun getUser(accessToken: String, userId: String): User {
val request = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/users/$userId")
.get()
.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 get user")
}
return response.body?.string()?.fromJson<User>()
?: throw Exception("Empty response")
}
}
}
// Usage
try {
val user = userService.getUser(
"eyJhbGciOiJIUzI1NiIs...", // access token
"123e4567-e89b-12d3-a456-426614174000" // user ID
)
println("User: $user")
} catch (e: Exception) {
println("Failed to get user: ${e.message}")
}
import axios from 'axios';
interface User {
id: string;
email: string;
firstName?: string;
lastName?: string;
status: 'active' | 'inactive' | 'suspended';
provider: 'local' | 'google' | 'facebook' | 'apple';
providerInfo?: {
providerId?: string;
displayName?: string;
photoUrl?: string;
email?: string;
};
lastLoginAt?: string;
createdAt: string;
}
const getUser = async (accessToken: string, userId: string): Promise<User> => {
try {
const response = await axios.get(
`https://api.tktchurch.com/v1/auth/users/${userId}`,
{
headers: {
'Authorization': `Bearer ${accessToken}`
},
}
);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Failed to get user');
}
throw error;
}
};
// Usage
try {
const user = await getUser(
'eyJhbGciOiJIUzI1NiIs...', // access token
'123e4567-e89b-12d3-a456-426614174000' // user ID
);
console.log('User:', user);
} catch (error) {
console.error('Failed to get user:', error.message);
}
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"status": "active",
"provider": "google",
"providerInfo": {
"providerId": "12345",
"displayName": "John Doe",
"photoUrl": "https://example.com/photo.jpg",
"email": "[email protected]"
},
"lastLoginAt": "2024-01-20T08:30:00Z",
"createdAt": "2024-01-01T00:00:00Z"
}
{
"error": {
"status": 400,
"reason": "Invalid user ID format"
}
}
{
"error": {
"status": 401,
"reason": "Invalid or expired access token"
}
}
{
"error": {
"status": 404,
"reason": "User not found"
}
}
Users
Get User
Get details of a specific user
GET
/
auth
/
users
/
{id}
curl -X GET "https://api.tktchurch.com/v1/auth/users/123e4567-e89b-12d3-a456-426614174000" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
const getUser = async (accessToken, userId) => {
const response = await fetch(
`https://api.tktchurch.com/v1/auth/users/${userId}`,
{
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.reason);
}
return response.json();
};
// Usage
try {
const user = await getUser(
'eyJhbGciOiJIUzI1NiIs...', // access token
'123e4567-e89b-12d3-a456-426614174000' // user ID
);
console.log('User:', user);
} catch (error) {
console.error('Failed to get user:', error.message);
}
func getUser(accessToken: String, userId: UUID) async throws -> User {
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/users/\(userId)")!)
urlRequest.httpMethod = "GET"
urlRequest.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
let (data, response) = try await URLSession.shared.data(for: urlRequest)
guard let httpResponse = response as? HTTPURLResponse else {
throw URLError(.badServerResponse)
}
if httpResponse.statusCode != 200 {
let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
throw error
}
return try JSONDecoder().decode(User.self, from: data)
}
// Usage
do {
let user = try await getUser(
accessToken: "eyJhbGciOiJIUzI1NiIs...",
userId: UUID(uuidString: "123e4567-e89b-12d3-a456-426614174000")!
)
print("User:", user)
} catch {
print("Failed to get user: \(error.localizedDescription)")
}
class UserService(private val client: OkHttpClient) {
suspend fun getUser(accessToken: String, userId: String): User {
val request = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/users/$userId")
.get()
.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 get user")
}
return response.body?.string()?.fromJson<User>()
?: throw Exception("Empty response")
}
}
}
// Usage
try {
val user = userService.getUser(
"eyJhbGciOiJIUzI1NiIs...", // access token
"123e4567-e89b-12d3-a456-426614174000" // user ID
)
println("User: $user")
} catch (e: Exception) {
println("Failed to get user: ${e.message}")
}
import axios from 'axios';
interface User {
id: string;
email: string;
firstName?: string;
lastName?: string;
status: 'active' | 'inactive' | 'suspended';
provider: 'local' | 'google' | 'facebook' | 'apple';
providerInfo?: {
providerId?: string;
displayName?: string;
photoUrl?: string;
email?: string;
};
lastLoginAt?: string;
createdAt: string;
}
const getUser = async (accessToken: string, userId: string): Promise<User> => {
try {
const response = await axios.get(
`https://api.tktchurch.com/v1/auth/users/${userId}`,
{
headers: {
'Authorization': `Bearer ${accessToken}`
},
}
);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Failed to get user');
}
throw error;
}
};
// Usage
try {
const user = await getUser(
'eyJhbGciOiJIUzI1NiIs...', // access token
'123e4567-e89b-12d3-a456-426614174000' // user ID
);
console.log('User:', user);
} catch (error) {
console.error('Failed to get user:', error.message);
}
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"status": "active",
"provider": "google",
"providerInfo": {
"providerId": "12345",
"displayName": "John Doe",
"photoUrl": "https://example.com/photo.jpg",
"email": "[email protected]"
},
"lastLoginAt": "2024-01-20T08:30:00Z",
"createdAt": "2024-01-01T00:00:00Z"
}
{
"error": {
"status": 400,
"reason": "Invalid user ID format"
}
}
{
"error": {
"status": 401,
"reason": "Invalid or expired access token"
}
}
{
"error": {
"status": 404,
"reason": "User not found"
}
}
This endpoint requires authentication.
Path Parameters
string
required
The UUID of the user to retrieve
Response
string
User’s unique identifier (UUID)
string
User’s email address
string
User’s first name
string
User’s last name
string
User’s account status. One of:
active: User is active and can access the systeminactive: User is inactive (unverified email or deactivated account)suspended: User is temporarily suspended
string
Primary authentication provider. One of:
local: Local authentication using email and passwordgoogle: Google OAuth authenticationfacebook: Facebook OAuth authenticationapple: Apple Sign In authentication
object
string
Timestamp of last login
string
Account creation timestamp
Error Responses
object
Common error cases:
- 400 Bad Request: Invalid user ID format
- 401 Unauthorized: Missing or invalid access token
- 404 Not Found: User not found
curl -X GET "https://api.tktchurch.com/v1/auth/users/123e4567-e89b-12d3-a456-426614174000" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
const getUser = async (accessToken, userId) => {
const response = await fetch(
`https://api.tktchurch.com/v1/auth/users/${userId}`,
{
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.reason);
}
return response.json();
};
// Usage
try {
const user = await getUser(
'eyJhbGciOiJIUzI1NiIs...', // access token
'123e4567-e89b-12d3-a456-426614174000' // user ID
);
console.log('User:', user);
} catch (error) {
console.error('Failed to get user:', error.message);
}
func getUser(accessToken: String, userId: UUID) async throws -> User {
var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/auth/users/\(userId)")!)
urlRequest.httpMethod = "GET"
urlRequest.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
let (data, response) = try await URLSession.shared.data(for: urlRequest)
guard let httpResponse = response as? HTTPURLResponse else {
throw URLError(.badServerResponse)
}
if httpResponse.statusCode != 200 {
let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
throw error
}
return try JSONDecoder().decode(User.self, from: data)
}
// Usage
do {
let user = try await getUser(
accessToken: "eyJhbGciOiJIUzI1NiIs...",
userId: UUID(uuidString: "123e4567-e89b-12d3-a456-426614174000")!
)
print("User:", user)
} catch {
print("Failed to get user: \(error.localizedDescription)")
}
class UserService(private val client: OkHttpClient) {
suspend fun getUser(accessToken: String, userId: String): User {
val request = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/users/$userId")
.get()
.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 get user")
}
return response.body?.string()?.fromJson<User>()
?: throw Exception("Empty response")
}
}
}
// Usage
try {
val user = userService.getUser(
"eyJhbGciOiJIUzI1NiIs...", // access token
"123e4567-e89b-12d3-a456-426614174000" // user ID
)
println("User: $user")
} catch (e: Exception) {
println("Failed to get user: ${e.message}")
}
import axios from 'axios';
interface User {
id: string;
email: string;
firstName?: string;
lastName?: string;
status: 'active' | 'inactive' | 'suspended';
provider: 'local' | 'google' | 'facebook' | 'apple';
providerInfo?: {
providerId?: string;
displayName?: string;
photoUrl?: string;
email?: string;
};
lastLoginAt?: string;
createdAt: string;
}
const getUser = async (accessToken: string, userId: string): Promise<User> => {
try {
const response = await axios.get(
`https://api.tktchurch.com/v1/auth/users/${userId}`,
{
headers: {
'Authorization': `Bearer ${accessToken}`
},
}
);
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
throw new Error(error.response?.data?.error?.reason || 'Failed to get user');
}
throw error;
}
};
// Usage
try {
const user = await getUser(
'eyJhbGciOiJIUzI1NiIs...', // access token
'123e4567-e89b-12d3-a456-426614174000' // user ID
);
console.log('User:', user);
} catch (error) {
console.error('Failed to get user:', error.message);
}
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"status": "active",
"provider": "google",
"providerInfo": {
"providerId": "12345",
"displayName": "John Doe",
"photoUrl": "https://example.com/photo.jpg",
"email": "[email protected]"
},
"lastLoginAt": "2024-01-20T08:30:00Z",
"createdAt": "2024-01-01T00:00:00Z"
}
{
"error": {
"status": 400,
"reason": "Invalid user ID format"
}
}
{
"error": {
"status": 401,
"reason": "Invalid or expired access token"
}
}
{
"error": {
"status": 404,
"reason": "User not found"
}
}
