Skip to content

Authentication

Davide Santangelo edited this page Oct 17, 2022 · 7 revisions

dato.rss API uses OAuth 2.0 token for user authorization and API authentication. Applications must be authorized and authenticated before they can fetch data.

PERMISSIONS [read,write,webhook]

permissions let you specify exactly what type of access you need. Permissions limit access for OAuth tokens. They do not grant any additional permission beyond that which the user already has.

GET TOKEN ( expires in 2 hours )

# POST /tokens
RestClient.post "https://<your.host>/api/tokens", {}

REFRESH TOKEN

# POST /tokens/refresh
RestClient.post "https://<your.host>/api/tokens/refresh", {}, { Authorization: "Token #{TOKEN}" }

CURRENT TOKEN

# GET /tokens/current
RestClient.get "https://<your.host>/api/tokens/current", { Authorization: "Token #{TOKEN}" }

RESPONSE ( get, refresh and current )

{
  "data": {
    "id": "c50bc253-9a49-48b6-aee7-a93782a108a6",
    "type": "token",
    "attributes": {
      "key": "AoaNW3PnEplDB8mLqghiXMcfons_BOUqNeJe1iy9bwsdijqNcE3BBkzXSNYjZ4ROYf1zevKzC4e-Q7JgYd3Gtg",
      "expires_at": 1612175284,
      "active": true,
      "permissions": [
        "read"
      ]
    }
  }
}