Token

Interactions with the authenticated token

Endpoints:

GET /token

Token: user

Scope: any

Retrieve an object with the currently authenticated token, username, and user ID.

Includes data.email if email scope is authorized.

Example
curl "https://api.pnut.io/v0/token" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns the requested token

{
    "meta": {
        "code": 200
    },
    "data": {
        "app": {
            "id": "String",
            "link": "https://example.com",
            "name": "String"
        },
        "scopes": [
            "String",
            "String",
            "String"
        ],
        "user": {"...User Object..."},
        "storage": {
            "available": 0,
            "total": 0
        }
    }
}

DELETE /token

Token: user

Scope: any

Delete the currently authenticated token.

Note that this only deletes the currently authenticated token, and the user will still not be required to reauthorize scopes in the future that have been authorized. For the user to revoke all access tokens for the client, they must do so manually from their account on pnut.io.

Example
curl "https://api.pnut.io/v0/token" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1" \
    -X DELETE

Returns the deleted token

{
    "meta": {
        "code": 200
    },
    "data": {
        "app": {
            "id": "String",
            "link": "https://example.com",
            "name": "String"
        },
        "scopes": [
            "String",
            "String",
            "String"
        ],
        "user": {"...User Object..."},
        "storage": {
            "available": 0,
            "total": 0
        }
    }
}