Harmont docs

Auth

The Auth endpoints mint and exchange Harmont session tokens. They are the only endpoints in this API where the request is unauthenticated on purpose; everything else takes a Bearer header from one of these.

Claim a transferred session token (CLI loopback poll)

POST
/api/v0/auth/cli/claim

Request Body

application/json

Claim request

TypeScript Definitions

Use the request body type in TypeScript.

nonce*string

The nonce the CLI generated for this loopback handoff.

Response Body

application/json

application/json

curl -X POST "https://api.harmont.dev/api/v0/auth/cli/claim" \  -H "Content-Type: application/json" \  -d '{    "nonce": "a7Kp...random"  }'
{
  "token": "string"
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}

Mint a human-typeable CLI paste code

POST
/api/v0/auth/cli/code
AuthorizationBearer <token>

A Harmont session bearer token.

In: header

Response Body

application/json

curl -X POST "https://api.harmont.dev/api/v0/auth/cli/code"
{
  "code": "K7P2QR9MX3WZ4NTV"
}

Redeem a CLI paste code for a session token

POST
/api/v0/auth/cli/redeem

Request Body

application/json

Redeem request

TypeScript Definitions

Use the request body type in TypeScript.

code*string

The paste code shown by the SPA.

Response Body

application/json

application/json

curl -X POST "https://api.harmont.dev/api/v0/auth/cli/redeem" \  -H "Content-Type: application/json" \  -d '{    "code": "K7P2QR9MX3WZ4NTV"  }'
{
  "token": "string"
}
{
  "error": {
    "code": "string",
    "doc_url": "string",
    "message": "string",
    "request_id": "string",
    "type": "string"
  }
}

Hand a session token to a locally-running CLI (loopback)

POST
/api/v0/auth/cli/transfer
AuthorizationBearer <token>

A Harmont session bearer token.

In: header

Request Body

application/json

Transfer request

TypeScript Definitions

Use the request body type in TypeScript.

nonce*string

The opaque nonce the CLI generated and is polling claim with.

Response Body

curl -X POST "https://api.harmont.dev/api/v0/auth/cli/transfer" \  -H "Content-Type: application/json" \  -d '{    "nonce": "a7Kp...random"  }'
Empty

Log out (revoke the current bearer token)

POST
/api/v0/auth/logout
AuthorizationBearer <token>

A Harmont session bearer token.

In: header

Response Body

curl -X POST "https://api.harmont.dev/api/v0/auth/logout"
Empty