curl -X POST "https://api.tktchurch.com/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword123"
}'
const response = await fetch('https://api.tktchurch.com/v1/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: '[email protected]',
password: 'securepassword123'
})
});
const data = await response.json();
struct LoginRequest: Codable {
let email: String
let password: String
}
let request = LoginRequest(
email: "[email protected]",
password: "securepassword123"
)
let url = URL(string: "https://api.tktchurch.com/v1/auth/login")!
var urlRequest = URLRequest(url: url)
urlRequest.httpMethod = "POST"
urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
urlRequest.httpBody = try? JSONEncoder().encode(request)
let (data, response) = try await URLSession.shared.data(for: urlRequest)
let result = try JSONDecoder().decode(AuthResponse.self, from: data)
data class LoginRequest(
val email: String,
val password: String
)
suspend fun login(email: String, password: String) {
val client = OkHttpClient()
val request = LoginRequest(email, password)
val json = Gson().toJson(request)
val requestBody = json.toRequestBody("application/json".toMediaType())
val httpRequest = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/login")
.post(requestBody)
.header("Content-Type", "application/json")
.build()
client.newCall(httpRequest).execute().use { response ->
if (response.isSuccessful) {
val responseData = response.body?.string()
// Handle success
} else {
// Handle error
}
}
}
import axios from 'axios';
const login = async (email: string, password: string) => {
try {
const response = await axios.post('https://api.tktchurch.com/v1/auth/login', {
email,
password
}, {
headers: {
'Content-Type': 'application/json'
}
});
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
// Handle error response
const errorMessage = error.response?.data?.error?.reason || 'Login failed';
throw new Error(errorMessage);
}
throw error;
}
};
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "eyJhbGciOiJIUzI1NiIs...",
"expires_in": 3600,
"token_type": "bearer"
}
{
"error": {
"status": 401,
"reason": "Invalid credentials"
}
}
{
"error": {
"status": 400,
"reason": "Validation error: email is required"
}
}
Authentication
Login to Account
Authenticate user with email and password
POST
/
auth
/
login
curl -X POST "https://api.tktchurch.com/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword123"
}'
const response = await fetch('https://api.tktchurch.com/v1/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: '[email protected]',
password: 'securepassword123'
})
});
const data = await response.json();
struct LoginRequest: Codable {
let email: String
let password: String
}
let request = LoginRequest(
email: "[email protected]",
password: "securepassword123"
)
let url = URL(string: "https://api.tktchurch.com/v1/auth/login")!
var urlRequest = URLRequest(url: url)
urlRequest.httpMethod = "POST"
urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
urlRequest.httpBody = try? JSONEncoder().encode(request)
let (data, response) = try await URLSession.shared.data(for: urlRequest)
let result = try JSONDecoder().decode(AuthResponse.self, from: data)
data class LoginRequest(
val email: String,
val password: String
)
suspend fun login(email: String, password: String) {
val client = OkHttpClient()
val request = LoginRequest(email, password)
val json = Gson().toJson(request)
val requestBody = json.toRequestBody("application/json".toMediaType())
val httpRequest = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/login")
.post(requestBody)
.header("Content-Type", "application/json")
.build()
client.newCall(httpRequest).execute().use { response ->
if (response.isSuccessful) {
val responseData = response.body?.string()
// Handle success
} else {
// Handle error
}
}
}
import axios from 'axios';
const login = async (email: string, password: string) => {
try {
const response = await axios.post('https://api.tktchurch.com/v1/auth/login', {
email,
password
}, {
headers: {
'Content-Type': 'application/json'
}
});
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
// Handle error response
const errorMessage = error.response?.data?.error?.reason || 'Login failed';
throw new Error(errorMessage);
}
throw error;
}
};
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "eyJhbGciOiJIUzI1NiIs...",
"expires_in": 3600,
"token_type": "bearer"
}
{
"error": {
"status": 401,
"reason": "Invalid credentials"
}
}
{
"error": {
"status": 400,
"reason": "Validation error: email is required"
}
}
This is a public endpoint that does not require authentication.
Body
string
required
The email address of the account
string
required
The account password
Response
string
JWT access token for authenticated requests
string
JWT refresh token for obtaining new access tokens
integer
Token expiration time in seconds
string
Type of token (always “bearer”)
Error Responses
object
The API will return a 401 Unauthorized status code with “Invalid credentials” message in these cases:
- User with provided email does not exist
- Password verification fails
curl -X POST "https://api.tktchurch.com/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword123"
}'
const response = await fetch('https://api.tktchurch.com/v1/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: '[email protected]',
password: 'securepassword123'
})
});
const data = await response.json();
struct LoginRequest: Codable {
let email: String
let password: String
}
let request = LoginRequest(
email: "[email protected]",
password: "securepassword123"
)
let url = URL(string: "https://api.tktchurch.com/v1/auth/login")!
var urlRequest = URLRequest(url: url)
urlRequest.httpMethod = "POST"
urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
urlRequest.httpBody = try? JSONEncoder().encode(request)
let (data, response) = try await URLSession.shared.data(for: urlRequest)
let result = try JSONDecoder().decode(AuthResponse.self, from: data)
data class LoginRequest(
val email: String,
val password: String
)
suspend fun login(email: String, password: String) {
val client = OkHttpClient()
val request = LoginRequest(email, password)
val json = Gson().toJson(request)
val requestBody = json.toRequestBody("application/json".toMediaType())
val httpRequest = Request.Builder()
.url("https://api.tktchurch.com/v1/auth/login")
.post(requestBody)
.header("Content-Type", "application/json")
.build()
client.newCall(httpRequest).execute().use { response ->
if (response.isSuccessful) {
val responseData = response.body?.string()
// Handle success
} else {
// Handle error
}
}
}
import axios from 'axios';
const login = async (email: string, password: string) => {
try {
const response = await axios.post('https://api.tktchurch.com/v1/auth/login', {
email,
password
}, {
headers: {
'Content-Type': 'application/json'
}
});
return response.data;
} catch (error) {
if (axios.isAxiosError(error)) {
// Handle error response
const errorMessage = error.response?.data?.error?.reason || 'Login failed';
throw new Error(errorMessage);
}
throw error;
}
};
{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "eyJhbGciOiJIUzI1NiIs...",
"expires_in": 3600,
"token_type": "bearer"
}
{
"error": {
"status": 401,
"reason": "Invalid credentials"
}
}
{
"error": {
"status": 400,
"reason": "Validation error: email is required"
}
}
