Athena

Auth Social and Provider Accounts

Social account linking/unlinking and token/health helper routes.

Endpoints and Methods

  • auth.social.link() -> POST /link-social
  • auth.account.list() -> GET /list-accounts
  • auth.account.unlink() -> POST /unlink-account
  • auth.deleteUser.callback() -> GET /delete-user/callback
  • auth.refreshToken() -> POST /refresh-token
  • auth.getAccessToken() -> POST /get-access-token
  • auth.health() -> GET /health (fallback to GET /ok on 404)
  • auth.ok() -> GET /ok
  • auth.error() -> GET /error

Examples

ATHENA_AUTH_BASE_URL="http://localhost:3001/api/auth"
ATHENA_AUTH_TOKEN="<bearer-token>"

# Adjust payload fields using the OpenAPI schema in this page.

# auth.social.link() -> POST /link-social
curl -X POST "$ATHENA_AUTH_BASE_URL/link-social" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.account.list() -> GET /list-accounts
curl -X GET "$ATHENA_AUTH_BASE_URL/list-accounts" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN"

# auth.account.unlink() -> POST /unlink-account
curl -X POST "$ATHENA_AUTH_BASE_URL/unlink-account" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.deleteUser.callback() -> GET /delete-user/callback
curl -X GET "$ATHENA_AUTH_BASE_URL/delete-user/callback" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN"

# auth.refreshToken() -> POST /refresh-token
curl -X POST "$ATHENA_AUTH_BASE_URL/refresh-token" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.getAccessToken() -> POST /get-access-token
curl -X POST "$ATHENA_AUTH_BASE_URL/get-access-token" \
  -H "content-type: application/json" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
  -d '{"...":"See OpenAPI requestBody schema"}'

# auth.health() -> GET /health
curl -X GET "$ATHENA_AUTH_BASE_URL/health" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN"

# auth.ok() -> GET /ok
curl -X GET "$ATHENA_AUTH_BASE_URL/ok" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN"

# auth.error() -> GET /error
curl -X GET "$ATHENA_AUTH_BASE_URL/error" \
  -H "authorization: Bearer $ATHENA_AUTH_TOKEN"
use reqwest::Client;
use serde_json::json;

let base_url = "http://localhost:3001/api/auth";
let token = "<bearer-token>";
let http = Client::new();

// Adjust payload fields using the OpenAPI schema in this page.

// auth.social.link() -> POST /link-social
let response = http
    .post(format!("{base_url}/link-social"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.account.list() -> GET /list-accounts
let response = http
    .get(format!("{base_url}/list-accounts"))
    .bearer_auth(token)
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.account.unlink() -> POST /unlink-account
let response = http
    .post(format!("{base_url}/unlink-account"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.deleteUser.callback() -> GET /delete-user/callback
let response = http
    .get(format!("{base_url}/delete-user/callback"))
    .bearer_auth(token)
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.refreshToken() -> POST /refresh-token
let response = http
    .post(format!("{base_url}/refresh-token"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.getAccessToken() -> POST /get-access-token
let response = http
    .post(format!("{base_url}/get-access-token"))
    .bearer_auth(token)
    .json(&json!({
        "...": "See OpenAPI requestBody schema"
    }))
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.health() -> GET /health
let response = http
    .get(format!("{base_url}/health"))
    .bearer_auth(token)
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.ok() -> GET /ok
let response = http
    .get(format!("{base_url}/ok"))
    .bearer_auth(token)
    .send()
    .await?;
let _ = response.error_for_status()?;

// auth.error() -> GET /error
let response = http
    .get(format!("{base_url}/error"))
    .bearer_auth(token)
    .send()
    .await?;
let _ = response.error_for_status()?;
import { client } from "./auth-client"

await client.auth.social.link({
  provider: "google",
  callbackURL: "https://app.example.com/auth/callback",
})

await client.auth.account.list()

await client.auth.account.unlink({
  providerId: "google",
  accountId: "acc_123",
})

await client.auth.deleteUser.callback({
  token: "delete_callback_token",
  callbackURL: "https://app.example.com/delete-callback",
})

await client.auth.refreshToken({
  providerId: "google",
  accountId: "acc_123",
  userId: "usr_123",
})

await client.auth.getAccessToken({
  providerId: "google",
  accountId: "acc_123",
  userId: "usr_123",
})

await client.auth.health()
await client.auth.ok()
await client.auth.error()

OpenAPI Contract

POST
/link-social

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

callbackURL?string

The URL to redirect to after the user has signed in

provider*string

The OAuth2 provider to use

scopes?string

Additional scopes to request from the provider

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/link-social" \  -H "Content-Type: application/json" \  -d '{    "provider": "string"  }'
{
  "url": "string",
  "redirect": true
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
GET
/list-accounts

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "http://localhost:3001/api/auth/list-accounts"
[
  {
    "id": "string",
    "provider": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  }
]
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
POST
/unlink-account

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

providerId*string
accountId?string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/unlink-account" \  -H "Content-Type: application/json" \  -d '{    "providerId": "string"  }'
{
  "status": true
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
GET
/delete-user/callback

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Query Parameters

token?string
callbackURL?string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "http://localhost:3001/api/auth/delete-user/callback"
{
  "success": true,
  "message": "User deleted"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
POST
/refresh-token

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

providerId*string

The provider ID for the OAuth provider

accountId?string

The account ID associated with the refresh token

userId?string

The user ID associated with the account

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/refresh-token" \  -H "Content-Type: application/json" \  -d '{    "providerId": "string"  }'
{
  "tokenType": "string",
  "idToken": "string",
  "accessToken": "string",
  "refreshToken": "string",
  "accessTokenExpiresAt": "2019-08-24T14:15:22Z",
  "refreshTokenExpiresAt": "2019-08-24T14:15:22Z"
}
Empty
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
POST
/get-access-token

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Request Body

application/json

providerId*string

The provider ID for the OAuth provider

accountId?string

The account ID associated with the refresh token

userId?string

The user ID associated with the account

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3001/api/auth/get-access-token" \  -H "Content-Type: application/json" \  -d '{    "providerId": "string"  }'
{
  "tokenType": "string",
  "idToken": "string",
  "accessToken": "string",
  "refreshToken": "string",
  "accessTokenExpiresAt": "2019-08-24T14:15:22Z",
  "refreshTokenExpiresAt": "2019-08-24T14:15:22Z"
}
Empty
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
GET
/health

Authorization

apiKeyCookie bearerAuth
apiKeyCookie<token>

API Key authentication via cookie

In: cookie

AuthorizationBearer <token>

Bearer token authentication

In: header

Response Body

application/json

curl -X GET "http://localhost:3001/api/auth/health"
{
  "status": "string",
  "service": "string",
  "version": "string"
}
GET
/ok

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "http://localhost:3001/api/auth/ok"
{
  "ok": true
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
GET
/error

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication

In: header

Response Body

text/html

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "http://localhost:3001/api/auth/error"
"string"
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}
{
  "message": "string"
}