본문 바로가기
WIKI 기술 지식 베이스

API 토큰 검증

원문 보기 위키 갱신

API 토큰 검증 (Validate API Token)

사용자 계정에 속한 API 토큰이 유효한지 확인하는 엔드포인트예요. 토큰 만료 시각도 함께 돌려줘서, 만료 관리에 바로 쓸 수 있어요.

출처: 문서

본문

Validates an API token belonging to a user.

GET /v1/auth/validate를 호출하면 토큰의 유효성과 만료 시각을 확인할 수 있어요.

```bash cURL theme={null} curl -L 'https://api.turso.tech/v1/auth/validate' \ -H 'Authorization: Bearer ***' ```
import { createClient } from "@tursodatabase/api";

const turso = createClient({
  org: "...",
  token: "",
});

const response = await turso.apiTokens.validate("...");

OpenAPI

openapi: 3.0.1
info:
  title: Turso Platform API
  description: API description here
  license:
    name: MIT
  version: 0.1.0
servers:
  - url: https://api.turso.tech
    description: Turso's Platform API
security: []
paths:
  /v1/auth/validate:
    get:
      summary: Validate API Token
      description: Validates an API token belonging to a user.
      operationId: validateAPIToken
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  exp:
                    type: integer
                    description: >-
                      The time of expiration for the provided token in unix
                      epoch seconds, or `-1` if there is no expiration.
                    example: 999

더 알아보기 (Learn more)