Login
Email/password and OAuth login
Login with email and password
POST
/loginRequest Body
{
"email": "user@example.com",
"password": "string",
"redirect_url": "string"
}
Code Examples
curl -X POST "https://platform.antfly.io/api/v1/login" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "string",
"redirect_url": "string"
}'const response = await fetch("https://platform.antfly.io/api/v1/login", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"email": "user@example.com",
"password": "string",
"redirect_url": "string"
})
});
const data = await response.json();Responses
{
"requires_two_factor": true,
"temp_token": "string",
"redirect_url": "string"
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Initiate OAuth login
GET
/oauth/{provider}/loginRedirects to OAuth provider login page
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
provider | string (google, github) | path | Yes | |
return_to | string | query | No | URL to return to after OAuth flow |
Code Examples
curl -X GET "https://platform.antfly.io/api/v1/oauth/google/login?return_to=string" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://platform.antfly.io/api/v1/oauth/google/login?return_to=string", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_TOKEN"
}
});
const data = await response.json();Responses
{
"success": true
}No response body
{
"error": "string",
"message": "string"
}OAuth callback handler
GET
/oauth/{provider}/callbackHandles OAuth provider callback, creates session, and redirects
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
provider | string (google, github) | path | Yes | |
code | string | query | Yes | OAuth authorization code |
state | string | query | Yes | CSRF protection state |
Code Examples
curl -X GET "https://platform.antfly.io/api/v1/oauth/google/callback?code=string&state=string" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://platform.antfly.io/api/v1/oauth/google/callback?code=string&state=string", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_TOKEN"
}
});
const data = await response.json();Responses
{
"success": true
}No response body
{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Link OAuth provider to account
GET
/oauth/{provider}/linkInitiates OAuth flow to link a provider to the authenticated user's account
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
provider | string (google, github) | path | Yes |
Code Examples
curl -X GET "https://platform.antfly.io/api/v1/oauth/google/link" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://platform.antfly.io/api/v1/oauth/google/link", {
method: "GET",
headers: {
Authorization: "Bearer YOUR_TOKEN"
}
});
const data = await response.json();Responses
{
"success": true
}No response body
{
"error": "string",
"message": "string"
}Unlink OAuth provider from account
POST
/oauth/{provider}/unlinkParameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
provider | string (google, github) | path | Yes |
Code Examples
curl -X POST "https://platform.antfly.io/api/v1/oauth/google/unlink" \
-H "Authorization: Bearer YOUR_TOKEN"const response = await fetch("https://platform.antfly.io/api/v1/oauth/google/unlink", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN"
}
});
const data = await response.json();Responses
{
"success": true
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}